commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Neidhart (JIRA)" <>
Subject [jira] [Commented] (COLLECTIONS-439) TreeBag with comparator does not store non-key duplicates.
Date Sat, 20 Apr 2013 13:31:15 GMT


Thomas Neidhart commented on COLLECTIONS-439:

In fact, this bag would be very similar to a MultiValueMap which decorates a TreeMap:

MultiValueMap<String, String> map =
   MultiValueMap.<String, String>multiValueMap(new TreeMap<String, Collection<String>>(comparator));

The Bag interface would be more convenient to use, e.g. instead of calling put(obj, obj),
you could do add(obj).
> 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.0
>         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