You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Stephen Colebourne <sc...@btopenworld.com> on 2004/04/26 01:46:35 UTC

[collections] Bag interface

The current Bag interface has the following javadoc warning:

 * <i>Note that this interface violates the {@link Collection} contract.</i>
 * The behavior specified in many of these methods is <i>not</i> the same
 * as the behavior specified by <code>Collection</code>.  The noncompliant
methods
 * are clearly marked with "(Violation)".  A future
 * version of this class will specify the same behavior as
<code>Collection</code>,
 * which unfortunately will break backwards compatibility with this version.

This has caused bile-like derision in some quarters, and is not something
I've ever liked - its basically an artifact of collections history.

I propose that we change this to state that its wrong, but that we will keep
compatability:

 * <i>NOTE: This interface violates the {@link Collection} contract.</i>
 * The behavior specified in many of these methods is <i>not</i> the same
 * as the behavior specified by <code>Collection</code>.
 * The noncompliant methods are clearly marked with "(Violation)".
 * Exercise caution when using a bag as a <code>Collection</code>.
 * <p>
 * This violation resulted from the original specification of the interface.
 * In an ideal world, the interface would be changed to fix the problems,
however
 * it has been decided to maintain backwards compatibility instead.

Opinions?

Stephen



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


Re: [collections] Bag interface

Posted by Stephen Colebourne <sc...@btopenworld.com>.
From: "Michael Heuer" <he...@acm.org>
> > Opinions?
>
> How about creating a Bag2 (or a better name) interface that does not
> violate the Collection contract and deprecating Bag and friends?

This will be the solution in the future to achieve a correct Bag interface.
However, personally I'm not motivated to add a new interface and package -
what we have isn't great, but it does work.

Stephen


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


Re: [collections] Bag interface

Posted by Michael Heuer <he...@acm.org>.
On Mon, 26 Apr 2004, Stephen Colebourne wrote:

> The current Bag interface has the following javadoc warning:
>
>  * <i>Note that this interface violates the {@link Collection} contract.</i>
>  * The behavior specified in many of these methods is <i>not</i> the same
>  * as the behavior specified by <code>Collection</code>.  The noncompliant
> methods
>  * are clearly marked with "(Violation)".  A future
>  * version of this class will specify the same behavior as
> <code>Collection</code>,
>  * which unfortunately will break backwards compatibility with this version.
>
> This has caused bile-like derision in some quarters, and is not something
> I've ever liked - its basically an artifact of collections history.
>
> I propose that we change this to state that its wrong, but that we will keep
> compatability:
>
>  * <i>NOTE: This interface violates the {@link Collection} contract.</i>
>  * The behavior specified in many of these methods is <i>not</i> the same
>  * as the behavior specified by <code>Collection</code>.
>  * The noncompliant methods are clearly marked with "(Violation)".
>  * Exercise caution when using a bag as a <code>Collection</code>.
>  * <p>
>  * This violation resulted from the original specification of the interface.
>  * In an ideal world, the interface would be changed to fix the problems,
> however
>  * it has been decided to maintain backwards compatibility instead.
>
> Opinions?

How about creating a Bag2 (or a better name) interface that does not
violate the Collection contract and deprecating Bag and friends?

   michael


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