tidied up the entryset code

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@131227 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Henri Yandell 2003-10-03 06:25:03 +00:00
parent 9804521d1d
commit 79908ade0a
1 changed files with 13 additions and 13 deletions

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/decorators/Attic/OrderedMap.java,v 1.1 2003/10/03 06:24:13 bayard Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/decorators/Attic/OrderedMap.java,v 1.2 2003/10/03 06:25:03 bayard Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
@ -76,7 +76,7 @@ import org.apache.commons.collections.DefaultMapEntry;
* The order can be observed via the iterator or toArray methods.
*
* @since Commons Collections 3.0
* @version $Revision: 1.1 $ $Date: 2003/10/03 06:24:13 $
* @version $Revision: 1.2 $ $Date: 2003/10/03 06:25:03 $
*
* @author Henri Yandell
*/
@ -401,6 +401,16 @@ public class OrderedMap extends AbstractMapDecorator implements Map {
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 @@ public class OrderedMap extends AbstractMapDecorator implements Map {
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()[] {