diff --git a/src/java/org/apache/commons/collections/buffer/TransformedBuffer.java b/src/java/org/apache/commons/collections/buffer/TransformedBuffer.java index 123e67123..b890c16f4 100644 --- a/src/java/org/apache/commons/collections/buffer/TransformedBuffer.java +++ b/src/java/org/apache/commons/collections/buffer/TransformedBuffer.java @@ -70,11 +70,11 @@ public class TransformedBuffer extends TransformedCollection implements Bu * @throws IllegalArgumentException if buffer or transformer is null * @since Commons Collections 3.3 */ - // TODO: Generics - public static Buffer decorateTransform(Buffer buffer, Transformer transformer) { - TransformedBuffer decorated = new TransformedBuffer(buffer, transformer); - if (transformer != null && buffer != null && buffer.size() > 0) { - Object[] values = buffer.toArray(); + public static Buffer decorateTransform(Buffer buffer, Transformer transformer) { + TransformedBuffer decorated = new TransformedBuffer(buffer, transformer); // throws IAE if buffer or transformer is null + if (buffer.size() > 0) { + @SuppressWarnings("unchecked") // buffer is type + E[] values = (E[]) buffer.toArray(); buffer.clear(); for(int i=0; i