I wrote a collections data structure called a Bag.

Interface Bag extends Collection:

A Bag is a Collection that keeps a count of its members of the same
type, using hashCode to check for equality. Suppose you have a Bag that
contains {a, a, b, c}. Calling getCount(a) would return 2, while
calling uniqueSet() would return {a, b, c}.

New files are attached and patches are below. Junit tests are provided
as well.

Thanks,
Chuck

========================

Index: test/org/apache/commons/collections/TestAll.java
===================================================================
RCS file:
/home/cvspublic/jakarta-commons/collections/src/test/org/apache/commons/collections/TestAll.java,v
retrieving revision 1.10
diff -u -r1.10 TestAll.java
--- test/org/apache/commons/collections/TestAll.java    2001/08/23
12:04:40        1.10
+++ test/org/apache/commons/collections/TestAll.java    2001/08/27
17:35:43
@@ -88,8 +88,10 @@
         suite.addTest(TestFastHashMap1.suite());
         suite.addTest(TestFastTreeMap.suite());
         suite.addTest(TestFastTreeMap1.suite());
+        suite.addTest(TestHashBag.suite());
         suite.addTest(TestHashMap.suite());
         suite.addTest(TestSingletonIterator.suite());
+        suite.addTest(TestTreeBag.suite());
         suite.addTest(TestTreeMap.suite());
         return suite;
     }


Index: java/org/apache/commons/collections/package.html
===================================================================
RCS file:
/home/cvspublic/jakarta-commons/collections/src/java/org/apache/commons/collections/package.html,v
retrieving revision 1.3
diff -u -r1.3 package.html
--- java/org/apache/commons/collections/package.html    2001/08/17
23:00:26        1.3
+++ java/org/apache/commons/collections/package.html    2001/08/27
17:35:12
@@ -57,6 +57,18 @@
         </td>
       </tr>
       <tr>
+        <td valign="top">Bag Interface and Implementations</td>
+        <td>
+          {@link org.apache.commons.collections.Bag}<br>
+          {@link org.apache.commons.collections.HashBag}<br>
+          {@link org.apache.commons.collections.SortedBag}<br>
+          {@link org.apache.commons.collections.TreeBag}
+        </td>
+        <td valign="top">
+          New collections interface that keeps a count of its members.
+        </td>
+      </tr>
+      <tr>
         <td valign="top">Adapters</td>
         <td>
           {@link org.apache.commons.collections.ArrayEnumeration}<br>


__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

bag.tgz

Reply via email to