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/02 05:10:37 UTC

cvs commit: jakarta-commons/collections/src/java/org/apache/commons/collections/decorators OrderedSet.java

bayard      2003/10/01 20:10:37

  Modified:    collections/src/java/org/apache/commons/collections/decorators
                        OrderedSet.java
  Log:
  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.
  
  Revision  Changes    Path
  1.3       +13 -2     jakarta-commons/collections/src/java/org/apache/commons/collections/decorators/OrderedSet.java
  
  Index: OrderedSet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/decorators/OrderedSet.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- OrderedSet.java	20 Sep 2003 16:57:47 -0000	1.2
  +++ OrderedSet.java	2 Oct 2003 03:10:37 -0000	1.3
  @@ -264,6 +264,16 @@
           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 Object next() {
               last = iterator.next();
  +            System.err.println("RETURNING: "+last);
               return last;
           }
   
  
  
  

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