commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bay...@apache.org
Subject cvs commit: jakarta-commons/collections/src/java/org/apache/commons/collections/decorators OrderedMap.java
Date Fri, 03 Oct 2003 06:25:03 GMT
bayard      2003/10/02 23:25:03

  Modified:    collections/src/java/org/apache/commons/collections/decorators
                        OrderedMap.java
  Log:
  tidied up the entryset code
  
  Revision  Changes    Path
  1.2       +13 -13    jakarta-commons/collections/src/java/org/apache/commons/collections/decorators/OrderedMap.java
  
  Index: OrderedMap.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/decorators/OrderedMap.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- OrderedMap.java	3 Oct 2003 06:24:13 -0000	1.1
  +++ OrderedMap.java	3 Oct 2003 06:25:03 -0000	1.2
  @@ -401,6 +401,16 @@
               this.insertOrder = insertOrder;
           }
   
  +        public Set _entries() {
  +            Set set = new java.util.HashSet( this.insertOrder.size() );
  +            set = OrderedSet.decorate( set );
  +            for (Iterator it = insertOrder.iterator(); it.hasNext();) {
  +                Object key = it.next();
  +                set.add( new DefaultMapEntry( key, getMap().get( key ) ) );
  +            }
  +            return set;
  +        }
  +
           public int size() {
               return this.parent.size();
           }
  @@ -425,19 +435,9 @@
                   throw new IllegalArgumentException("Parameter must be a Map.Entry");
               }
           }
  -        // tmp
  -        public Set _entries() {
  +        public Iterator iterator() {
               // TODO: Needs to return a EntrySetViewIterator, which 
               //       removes from this and from the Map
  -            Set set = new java.util.HashSet( this.insertOrder.size() );
  -            set = OrderedSet.decorate( set );
  -            for (Iterator it = insertOrder.iterator(); it.hasNext();) {
  -                Object key = it.next();
  -                set.add( new DefaultMapEntry( key, getMap().get( key ) ) );
  -            }
  -            return set;
  -        }
  -        public Iterator iterator() {
               return _entries().iterator();
           }
           public Object toArray()[] {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message