From 7f0c6e905a5e9b9b060dd7a0d135dfc52d2185b1 Mon Sep 17 00:00:00 2001
From: Thomas Neidhart
* Suppose you have a Bag that contains
* NOTE: This interface violates the {@link Collection} contract.
* The behavior specified in many of these methods is not the same
* as the behavior specified by
* This violation resulted from the original specification of this interface.
* In an ideal world, the interface would be changed to fix the problems, however
- * it has been decided to maintain backwards compatibility instead.
* If the object is already in the {@link #uniqueSet()} then increment its
* count as reported by {@link #getCount(Object)}. Otherwise add it to the
- * {@link #uniqueSet()} and report its count as 1.
* Since this method always increases the size of the bag,
* according to the {@link Collection#add(Object)} contract, it
* should always return
* If the object is already in the {@link #uniqueSet()} then increment its
* count as reported by {@link #getCount(Object)}. Otherwise add it to the
- * {@link #uniqueSet()} and report its count as
- * This will also remove the object from the {@link #uniqueSet()}.
* According to the {@link Collection#remove(Object)} method,
* this method should only remove the first occurrence of the
- * given object, not all occurrences.
* If the number of copies to remove is greater than the actual number of
- * copies in the Bag, no error is thrown.
- * Uniqueness constraints are the same as those in {@link java.util.Set}.{a, a, b, c}
.
* Calling {@link #getCount(Object)} on a
would return 2, while
- * calling {@link #uniqueSet()} would return {a, b, c}
.{a, b, c}
.
* Collection
.
* The noncompliant methods are clearly marked with "(Violation)".
- * Exercise caution when using a bag as a Collection
.Collection
.
* true
. Since it sometimes returns
- * false
, this method violates the contract.false
, this method violates the contract.
*
* @param object the object to add
* @return true
if the object was not already in the uniqueSet
@@ -80,7 +80,7 @@ public interface BagnCopies
.nCopies
.
*
* @param object the object to add
* @param nCopies the number of copies to add
@@ -92,11 +92,11 @@ public interface Bagtrue
if this call changed the collection
@@ -107,7 +107,7 @@ public interface BagnCopies
copies of the specified object from the Bag.
*
true
if the Bag contains all the collection
@@ -160,7 +160,7 @@ public interface BagThe {@link Collection#removeAll(Collection)} method specifies * that cardinality should not be respected; this method should * remove all occurrences of every object contained in the - * given collection.
+ * given collection. * * @param coll the collection to remove * @returntrue
if this call changed the collection
@@ -181,7 +181,7 @@ public interface BagThe {@link Collection#retainAll(Collection)} method specifies * that cardinality should not be respected; this method should * keep all occurrences of every object contained in the - * given collection.
+ * given collection. * * @param coll the collection to retain * @returntrue
if this call changed the collection
diff --git a/src/main/java/org/apache/commons/collections/Buffer.java b/src/main/java/org/apache/commons/collections/Buffer.java
index a7116e8a3..cb398c4ce 100644
--- a/src/main/java/org/apache/commons/collections/Buffer.java
+++ b/src/main/java/org/apache/commons/collections/Buffer.java
@@ -23,17 +23,17 @@ import java.util.Collection;
* * The removal order can be based on insertion order (eg, a FIFO queue or a * LIFO stack), on access order (eg, an LRU cache), on some arbitrary comparator - * (eg, a priority queue) or on any other well-defined ordering.
+ * (eg, a priority queue) or on any other well-defined ordering. *
* Note that the removal order is not necessarily the same as the iteration
* order. A Buffer
implementation may have equivalent removal
- * and iteration orders, but this is not required.
* This interface does not specify any behavior for
* {@link Object#equals(Object)} and {@link Object#hashCode} methods. It
* is therefore possible for a Buffer
implementation to also
* also implement {@link java.util.List}, {@link java.util.Set} or
- * {@link Bag}.
* A Closure
represents a block of code which is executed from
- * inside some block, function or iteration. It operates an input object.
* Standard implementations of common closures are provided by - * {@link ClosureUtils}. These include method invocation and for/while loops.
+ * {@link ClosureUtils}. These include method invocation and for/while loops. * * @param
* A Factory
creates an object without using an input parameter.
- * If an input parameter is required, then {@link Transformer} is more appropriate.
* Standard implementations of common factories are provided by * {@link FactoryUtils}. These include factories that return a constant, - * a copy of a prototype or a new instance.
+ * a copy of a prototype or a new instance. * * @param
* A MultiMap
is a Map with slightly different semantics.
* Putting a value into the map will add the value to a Collection at that key.
- * Getting a value will return a Collection, holding all the values put to that key.
* For example: *
@@ -31,13 +31,13 @@ import java.util.Collection; * mhm.put(key, "A"); * mhm.put(key, "B"); * mhm.put(key, "C"); - * Collection coll = (Collection) mhm.get(key);+ * Collection coll = (Collection) mhm.get(key); *
- * coll
will be a collection containing "A", "B", "C".
coll
will be a collection containing "A", "B", "C".
*
* NOTE: Additional methods were added to this interface in Commons Collections 3.1.
* These were added solely for documentation purposes and do not change the interface
- * as they were defined in the superinterface Map
anyway.
Map
anyway.
*
* @since Commons Collections 2.0
* @version $Revision$