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:31 UTC

svn commit: r815030 - /commons/proper/collections/trunk/src/java/org/apache/commons/collections/buffer/PredicatedBuffer.java

Author: bayard
Date: Tue Sep 15 05:54:31 2009
New Revision: 815030

URL: http://svn.apache.org/viewvc?rev=815030&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
    ------------------------------------------------------------------------
    r471202 | scolebourne | 2006-11-04 06:21:44 -0800 (Sat, 04 Nov 2006) | 1 line
    
    Remove getCollection() - use covariant decorated()
    ------------------------------------------------------------------------

Modified:
    commons/proper/collections/trunk/src/java/org/apache/commons/collections/buffer/PredicatedBuffer.java

Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/buffer/PredicatedBuffer.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/buffer/PredicatedBuffer.java?rev=815030&r1=815029&r2=815030&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/buffer/PredicatedBuffer.java (original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/buffer/PredicatedBuffer.java Tue Sep 15 05:54:31 2009
@@ -39,7 +39,7 @@
  * @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 @@
      * @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 @@
      * @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 @@
      * 
      * @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();
     }
 
 }