You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by ba...@apache.org on 2003/10/03 08:25:03 UTC
cvs commit: jakarta-commons/collections/src/java/org/apache/commons/collections/decorators OrderedMap.java
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