Nentwig, Timo wrote:
Stephen Colebourne wrote:
Get what? What method signature are you expecting? What is your use case?
Well, get what I did add(). Get that what contains() is checking for.
Get what getCount() is counting.
I believe that you want the method:
public Object get(Object);
that would return the object within the Bag that is equal to the object
you pass in.
This has been discussed before as a deficiency in the Java Collections
Framework wrt the Set interface. At present, the workaround in Java is
to use a Map where the key and value are the same object.
As to your question, why doesn't Bag have such a method, the answer is
because the original coders didn't see the need for it. And since its an
interface, there is no way for us to change it now. It is also very
difficult to implement as the Java Collections Framework doesn't provide
such a method.
Stephen
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]