You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ba...@apache.org on 2009/09/15 07:54:10 UTC
svn commit: r815019 -
/commons/proper/collections/trunk/src/java/org/apache/commons/collections/Bag.java
Author: bayard
Date: Tue Sep 15 05:54:10 2009
New Revision: 815019
URL: http://svn.apache.org/viewvc?rev=815019&view=rev
Log:
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
------------------------------------------------------------------------
Modified:
commons/proper/collections/trunk/src/java/org/apache/commons/collections/Bag.java
Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/Bag.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/Bag.java?rev=815019&r1=815018&r2=815019&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/Bag.java (original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/Bag.java Tue Sep 15 05:54:10 2009
@@ -38,13 +38,14 @@
* In an ideal world, the interface would be changed to fix the problems, however
* it has been decided to maintain backwards compatibility instead.
*
+ * @param <E> 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<E> extends Collection<E> {
/**
* Returns the number of occurrences (cardinality) of the given
@@ -72,7 +73,7 @@
* @param object the object to add
* @return <code>true</code> if the object was not already in the <code>uniqueSet</code>
*/
- boolean add(Object object);
+ boolean add(E object);
/**
* Adds <code>nCopies</code> copies of the specified object to the Bag.
@@ -85,7 +86,7 @@
* @param nCopies the number of copies to add
* @return <code>true</code> if the object was not already in the <code>uniqueSet</code>
*/
- boolean add(Object object, int nCopies);
+ boolean add(E object, int nCopies);
/**
* <i>(Violation)</i>
@@ -120,7 +121,7 @@
*
* @return the Set of unique Bag elements
*/
- Set uniqueSet();
+ Set<E> uniqueSet();
/**
* Returns the total number of items in the bag across all types.
@@ -145,7 +146,7 @@
* @param coll the collection to check against
* @return <code>true</code> if the Bag contains all the collection
*/
- boolean containsAll(Collection coll);
+ boolean containsAll(Collection<?> coll);
/**
* <i>(Violation)</i>
@@ -163,7 +164,7 @@
* @param coll the collection to remove
* @return <code>true</code> if this call changed the collection
*/
- boolean removeAll(Collection coll);
+ boolean removeAll(Collection<?> coll);
/**
* <i>(Violation)</i>
@@ -184,7 +185,7 @@
* @param coll the collection to retain
* @return <code>true</code> 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 @@
*
* @return iterator over all elements in the Bag
*/
- Iterator iterator();
+ Iterator<E> iterator();
// The following is not part of the formal Bag interface, however where possible
// Bag implementations should follow these comments.
@@ -218,5 +219,5 @@
// * @return the hash code of the Bag
// */
// int hashCode();
-
+
}