commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claude Warren (JIRA)" <>
Subject [jira] [Commented] (COLLECTIONS-439) TreeBag with comparator does not store non-key duplicates.
Date Mon, 13 May 2013 08:05:16 GMT


Claude Warren commented on COLLECTIONS-439:

While the MultiValueMap may do the same thing.... I have not looked.  This is an implementation
of Bag and operates like a non-unique index on a database table. (In fact that is what I use
it to emulate)

Asking if this is useful because it has similar functionality to MultiValueMap is like asking
if Queue should be included when LinkedList can be used.

You use Queue because it provides a clue to any developers reading your code what you are
trying to do -- what you are thinking.  The same with Bag vs MultiValueMap.

I think it is a valid and useful addition to the collection and vote to include it.  But then
I contributed it so I would think that. :)

> TreeBag with comparator does not store non-key duplicates.
> ----------------------------------------------------------
>                 Key: COLLECTIONS-439
>                 URL:
>             Project: Commons Collections
>          Issue Type: Improvement
>          Components: Bag
>    Affects Versions: 3.2.1
>            Reporter: Claude Warren
>             Fix For: 4.x
>         Attachments: COLLECTIONS-439.tar.gz,
> When storing objects that are sorted by a Comparator, if the differences in the objects
are not in the comparator the same version of the object is returned.  I expected that the
sorted bag would work like a DB table with a non-unique key -- ordered but duplicate only
determined by Object.equals().
> I have implemented this type of bag using a TreeMap of List.  My implementation uses
the Jena ExtendedIterator to make building the iterator() and array() methods easier.
> Will attach the code.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message