On 05/13/2013 08:06 PM, Thomas Neidhart wrote:
> Hi,
> 
> currently, the Bag interface states that it violates the Collection
> contract. This is mainly because the interface was defined like that,
> but could be easily changed.
> 
> As we are not binary compatible anymore with previous releases, it would
> be the right time to do this now (or leave it as it is till the end of
> time).
> 
> Any opinions / objections on this?

Ok,

I needed some time to digest the feedback.

The result of playing around with an adapter from the Bag interface to a
newly proposed Multiset is attached to COLLECTIONS-468.

The Multiset interface would be exactly the same as Bag, with the
difference that it conforms to the Collection super-interface (Multiset
deliberately does not extend Bag).

The rest of the classes in the bag package could be migrated to a new
multiset package, basically providing the same functionality.

Additionally, there would be a MultisetUtils.asMultiset(Bag) method
which wraps a Bag as a Multiset (in case there is a need for something
like that).

This would give the users the choice, and we can later on still decide
if we remove the Bag interface after all.

I am not in favor of code duplication, but I see the benefit of both
interfaces. The adapter alone would limit the use of a Multiset, as the
unmodifiable, transformed and synchronized decorators would have to be
duplicated anyway.

Thomas

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to