From 3b29dde3b5f8eca019d3bdd3e7304986f113982e Mon Sep 17 00:00:00 2001 From: Henri Yandell Date: Tue, 15 Sep 2009 05:54:10 +0000 Subject: [PATCH] Merging from -r468106:814127 of collections_jdk5_branch - namely where this code was generified; mostly in r738956. Also see the following revisions: ------------------------------------------------------------------------ r555925 | skestle | 2007-07-13 03:39:24 -0700 (Fri, 13 Jul 2007) | 2 lines Added Edwin Tellman's patch for COLLECTIONS-243. It all seems pretty reasonable, and it should all be checked again as the project is worked through ------------------------------------------------------------------------ git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@815019 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/commons/collections/Bag.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/java/org/apache/commons/collections/Bag.java b/src/java/org/apache/commons/collections/Bag.java index 18205fe65..05e6f3e8d 100644 --- a/src/java/org/apache/commons/collections/Bag.java +++ b/src/java/org/apache/commons/collections/Bag.java @@ -38,13 +38,14 @@ import java.util.Set; * In an ideal world, the interface would be changed to fix the problems, however * it has been decided to maintain backwards compatibility instead. * + * @param the type held in the bag * @since Commons Collections 2.0 * @version $Revision$ $Date$ * * @author Chuck Burdick * @author Stephen Colebourne */ -public interface Bag extends Collection { +public interface Bag extends Collection { /** * Returns the number of occurrences (cardinality) of the given @@ -72,7 +73,7 @@ public interface Bag extends Collection { * @param object the object to add * @return true if the object was not already in the uniqueSet */ - boolean add(Object object); + boolean add(E object); /** * Adds nCopies copies of the specified object to the Bag. @@ -85,7 +86,7 @@ public interface Bag extends Collection { * @param nCopies the number of copies to add * @return true if the object was not already in the uniqueSet */ - boolean add(Object object, int nCopies); + boolean add(E object, int nCopies); /** * (Violation) @@ -120,7 +121,7 @@ public interface Bag extends Collection { * * @return the Set of unique Bag elements */ - Set uniqueSet(); + Set uniqueSet(); /** * Returns the total number of items in the bag across all types. @@ -145,7 +146,7 @@ public interface Bag extends Collection { * @param coll the collection to check against * @return true if the Bag contains all the collection */ - boolean containsAll(Collection coll); + boolean containsAll(Collection coll); /** * (Violation) @@ -163,7 +164,7 @@ public interface Bag extends Collection { * @param coll the collection to remove * @return true if this call changed the collection */ - boolean removeAll(Collection coll); + boolean removeAll(Collection coll); /** * (Violation) @@ -184,7 +185,7 @@ public interface Bag extends Collection { * @param coll the collection to retain * @return true if this call changed the collection */ - boolean retainAll(Collection coll); + boolean retainAll(Collection coll); /** * Returns an {@link Iterator} over the entire set of members, @@ -193,7 +194,7 @@ public interface Bag extends Collection { * * @return iterator over all elements in the Bag */ - Iterator iterator(); + Iterator iterator(); // The following is not part of the formal Bag interface, however where possible // Bag implementations should follow these comments. @@ -218,5 +219,5 @@ public interface Bag extends Collection { // * @return the hash code of the Bag // */ // int hashCode(); - + }