1 17 18 package org.apache.tomcat.util.collections; 19 20 import java.util.Enumeration ; 21 22 29 public final class MultiMapNamesEnumeration implements Enumeration { 30 int pos; 31 int size; 32 String next; 33 MultiMap headers; 34 35 38 43 MultiMapNamesEnumeration(MultiMap headers, boolean toString, 44 boolean unique) { 45 this.headers=headers; 46 pos=0; 47 size = headers.size(); 48 findNext(); 49 } 50 51 private void findNext() { 52 next=null; 53 for( ; pos< size; pos++ ) { 54 next=headers.getName( pos ).toString(); 55 for( int j=0; j<pos ; j++ ) { 56 if( headers.getName( j ).equalsIgnoreCase( next )) { 57 next=null; 59 break; 60 } 61 } 62 if( next!=null ) { 63 break; 65 } 66 } 67 pos++; 70 } 71 72 public boolean hasMoreElements() { 73 return next!=null; 74 } 75 76 public Object nextElement() { 77 String current=next; 78 findNext(); 79 return current; 80 } 81 } 82 | Popular Tags |