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
    ------------------------------------------------------------------------
    r471202 | scolebourne | 2006-11-04 06:21:44 -0800 (Sat, 04 Nov 2006) | 1 line
    
    Remove getCollection() - use covariant decorated()
    ------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@815030 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Henri Yandell 2009-09-15 05:54:31 +00:00
parent c02d4dfcbc
commit 18b81f0c31
1 changed files with 10 additions and 10 deletions

View File

@ -39,7 +39,7 @@ import org.apache.commons.collections.collection.PredicatedCollection;
* @author Stephen Colebourne
* @author Paul Jack
*/
public class PredicatedBuffer extends PredicatedCollection implements Buffer {
public class PredicatedBuffer<E> extends PredicatedCollection<E> implements Buffer<E> {
/** Serialization version */
private static final long serialVersionUID = 2307609000539943581L;
@ -56,8 +56,8 @@ public class PredicatedBuffer extends PredicatedCollection implements Buffer {
* @throws IllegalArgumentException if buffer or predicate is null
* @throws IllegalArgumentException if the buffer contains invalid elements
*/
public static Buffer decorate(Buffer buffer, Predicate predicate) {
return new PredicatedBuffer(buffer, predicate);
public static <T> Buffer<T> decorate(Buffer<T> buffer, Predicate<? super T> predicate) {
return new PredicatedBuffer<T>(buffer, predicate);
}
//-----------------------------------------------------------------------
@ -72,7 +72,7 @@ public class PredicatedBuffer extends PredicatedCollection implements Buffer {
* @throws IllegalArgumentException if buffer or predicate is null
* @throws IllegalArgumentException if the buffer contains invalid elements
*/
protected PredicatedBuffer(Buffer buffer, Predicate predicate) {
protected PredicatedBuffer(Buffer<E> buffer, Predicate<? super E> predicate) {
super(buffer, predicate);
}
@ -81,17 +81,17 @@ public class PredicatedBuffer extends PredicatedCollection implements Buffer {
*
* @return the decorated buffer
*/
protected Buffer getBuffer() {
return (Buffer) getCollection();
protected Buffer<E> decorated() {
return (Buffer<E>) super.decorated();
}
//-----------------------------------------------------------------------
public Object get() {
return getBuffer().get();
public E get() {
return decorated().get();
}
public Object remove() {
return getBuffer().remove();
public E remove() {
return decorated().remove();
}
}