commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m..@apache.org
Subject cvs commit: jakarta-commons/collections/src/java/org/apache/commons/collections DefaultMapBag.java
Date Sun, 16 Jun 2002 18:56:19 GMT
mas         2002/06/16 11:56:19

  Modified:    collections/src/java/org/apache/commons/collections
                        DefaultMapBag.java
  Log:
  Add a toString() to aid in debugging.
  
  Revision  Changes    Path
  1.4       +24 -3     jakarta-commons/collections/src/java/org/apache/commons/collections/DefaultMapBag.java
  
  Index: DefaultMapBag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/DefaultMapBag.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DefaultMapBag.java	12 Jun 2002 03:59:15 -0000	1.3
  +++ DefaultMapBag.java	16 Jun 2002 18:56:19 -0000	1.4
  @@ -334,6 +334,27 @@
      private int modCount() {
         return _mods;
      }
  +
  +    /**
  +     *  Implement a toString() method suitable for debugging
  +     **/
  +    public String toString() {
  +        StringBuffer buf = new StringBuffer();
  +        buf.append("[");
  +        Iterator i = uniqueSet().iterator();
  +        while(i.hasNext()) {
  +            Object current = i.next();
  +            int count = getCount(current);
  +            buf.append(count);
  +            buf.append(":");
  +            buf.append(current);
  +            if(i.hasNext()) {
  +                buf.append(",");
  +            }
  +        }
  +        buf.append("]");
  +        return buf.toString();
  +    }
   }
   
   
  
  
  

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


Mime
View raw message