Torsten Curdt wrote:
>>Are you thinking of a Bag?
> 
> 
> Doh! That's it ...thanks :)

Hm...

    org.apache.commons.collections.bag.HashBag bag
     = new org.apache.commons.collections.bag.HashBag();
    bag.add("a");
    System.out.println(bag.getCount("a"));
    bag.add("a");
    System.out.println(bag.getCount("a"));
    bag.remove("a");
    System.out.println(bag.getCount("a"));
    bag.remove("a");
    System.out.println(bag.getCount("a"));

gives

1
2
0
0

but I'd expect

1
2
1
0

this is because the remove(obj) is not
delegating to a remove(obj,1) but is
a full remove. ...so I have to extend
that class.

IMO having

 remove(obj) -> remove(obj,1)
 removeAll(obj)
 removeAll()

would make more sense.

My 2 cents

cheers
--
Torsten

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to