directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r473095 - /directory/branches/apacheds-schema/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SubstringFilter.java
Date Thu, 09 Nov 2006 22:16:08 GMT
Author: elecharny
Date: Thu Nov  9 14:16:08 2006
New Revision: 473095

URL: http://svn.apache.org/viewvc?view=rev&rev=473095
Log:
Fixed warnings by using generics

Modified:
    directory/branches/apacheds-schema/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SubstringFilter.java

Modified: directory/branches/apacheds-schema/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SubstringFilter.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds-schema/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SubstringFilter.java?view=diff&rev=473095&r1=473094&r2=473095
==============================================================================
--- directory/branches/apacheds-schema/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SubstringFilter.java
(original)
+++ directory/branches/apacheds-schema/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SubstringFilter.java
Thu Nov  9 14:16:08 2006
@@ -23,7 +23,6 @@
 import java.nio.BufferOverflowException;
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
-import java.util.Iterator;
 
 import org.apache.directory.shared.asn1.ber.tlv.TLV;
 import org.apache.directory.shared.asn1.ber.tlv.UniversalTag;
@@ -69,8 +68,8 @@
     /** The initial filter */
     private String initialSubstrings;
 
-    /** The any filter. It's a list of LdapString */
-    private ArrayList anySubstrings;
+    /** The any filter. It's a list of String */
+    private ArrayList<String> anySubstrings;
 
     /** The final filter */
     private String finalSubstrings;
@@ -91,7 +90,7 @@
      */
     public SubstringFilter()
     {
-        anySubstrings = new ArrayList( 1 );
+        anySubstrings = new ArrayList<String>( 1 );
     }
 
 
@@ -100,7 +99,7 @@
      * 
      * @return Returns the anySubstrings.
      */
-    public ArrayList getAnySubstrings()
+    public ArrayList<String> getAnySubstrings()
     {
         return anySubstrings;
     }
@@ -236,11 +235,8 @@
 
         if ( anySubstrings != null )
         {
-            Iterator anyIterator = anySubstrings.iterator();
-
-            while ( anyIterator.hasNext() )
+            for ( String any:anySubstrings )
             {
-                String any = ( String ) anyIterator.next();
                 int anyLength = StringTools.getBytesUtf8( any ).length; 
                 substringsFilterSequenceLength += 1 + TLV.getNbBytes( anyLength ) + anyLength;
             }
@@ -318,11 +314,8 @@
             // The any substrings
             if ( anySubstrings != null )
             {
-                Iterator anyIterator = anySubstrings.iterator();
-
-                while ( anyIterator.hasNext() )
+                for ( String any:anySubstrings )
                 {
-                    String any = ( String ) anyIterator.next();
                     byte[] anyBytes = StringTools.getBytesUtf8( any );
                     buffer.put( ( byte ) LdapConstants.SUBSTRINGS_FILTER_ANY_TAG );
                     buffer.put( TLV.getBytes( anyBytes.length ) );
@@ -367,11 +360,9 @@
 
         if ( anySubstrings != null )
         {
-            Iterator anyIterator = anySubstrings.iterator();
-
-            while ( anyIterator.hasNext() )
+            for ( String any:anySubstrings )
             {
-                sb.append( ( String ) anyIterator.next() ).append( '*' );
+                sb.append( any ).append( '*' );
             }
         }
 



Mime
View raw message