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 ------------------------------------------------------------------------ r471201 | scolebourne | 2006-11-04 06:17:26 -0800 (Sat, 04 Nov 2006) | 1 line Remove getBag() - use covariant decorated() ------------------------------------------------------------------------ git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@815011 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d82e7ce392
commit
1258f14c7a
|
@ -31,8 +31,11 @@ import org.apache.commons.collections.collection.AbstractCollectionDecorator;
|
||||||
*
|
*
|
||||||
* @author Stephen Colebourne
|
* @author Stephen Colebourne
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractBagDecorator
|
public abstract class AbstractBagDecorator<E>
|
||||||
extends AbstractCollectionDecorator implements Bag {
|
extends AbstractCollectionDecorator<E> implements Bag<E> {
|
||||||
|
|
||||||
|
/** Serialization version */
|
||||||
|
private static final long serialVersionUID = -3768146017343785417L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor only used in deserialization, do not use otherwise.
|
* Constructor only used in deserialization, do not use otherwise.
|
||||||
|
@ -48,7 +51,7 @@ public abstract class AbstractBagDecorator
|
||||||
* @param bag the bag to decorate, must not be null
|
* @param bag the bag to decorate, must not be null
|
||||||
* @throws IllegalArgumentException if list is null
|
* @throws IllegalArgumentException if list is null
|
||||||
*/
|
*/
|
||||||
protected AbstractBagDecorator(Bag bag) {
|
protected AbstractBagDecorator(Bag<E> bag) {
|
||||||
super(bag);
|
super(bag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,25 +60,25 @@ public abstract class AbstractBagDecorator
|
||||||
*
|
*
|
||||||
* @return the decorated bag
|
* @return the decorated bag
|
||||||
*/
|
*/
|
||||||
protected Bag getBag() {
|
protected Bag<E> decorated() {
|
||||||
return (Bag) getCollection();
|
return (Bag<E>) super.decorated();
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
public int getCount(Object object) {
|
public int getCount(Object object) {
|
||||||
return getBag().getCount(object);
|
return decorated().getCount(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean add(Object object, int count) {
|
public boolean add(E object, int count) {
|
||||||
return getBag().add(object, count);
|
return decorated().add(object, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean remove(Object object, int count) {
|
public boolean remove(Object object, int count) {
|
||||||
return getBag().remove(object, count);
|
return decorated().remove(object, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set uniqueSet() {
|
public Set<E> uniqueSet() {
|
||||||
return getBag().uniqueSet();
|
return decorated().uniqueSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue