Have made the OrderedSet use the underlying List's toString and not the Set's toString. It's important that the toString retains the correct order, else things can get quite confusing when debugging. Fortunately List and Set toStrings are the same, unless someone has custom versions in place.

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@131214 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Henri Yandell 2003-10-02 03:10:37 +00:00
parent 63a4d98529
commit 62543d554d

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/OrderedSet.java,v 1.2 2003/09/20 16:57:47 scolebourne Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/decorators/Attic/OrderedSet.java,v 1.3 2003/10/02 03:10:37 bayard Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
@ -82,7 +82,7 @@ import java.util.Set;
* various interface methods (notably equals/hashCode) are incompatable with a set.
*
* @since Commons Collections 3.0
* @version $Revision: 1.2 $ $Date: 2003/09/20 16:57:47 $
* @version $Revision: 1.3 $ $Date: 2003/10/02 03:10:37 $
*
* @author Stephen Colebourne
* @author Henning P. Schmiedehausen
@ -264,6 +264,16 @@ public class OrderedSet extends AbstractSetDecorator implements Set {
return obj;
}
/**
* Uses the underlying List's toString so that order is achieved.
* This means that the decorated Set's toString is not used, so
* any custom toStrings will be ignored.
*/
// Fortunately List.toString and Set.toString look the same
public String toString() {
return setOrder.toString();
}
//-----------------------------------------------------------------------
/**
* Internal iterator handle remove.
@ -282,6 +292,7 @@ public class OrderedSet extends AbstractSetDecorator implements Set {
public Object next() {
last = iterator.next();
System.err.println("RETURNING: "+last);
return last;
}