/** * Returns a transformed buffer backed by the given buffer. * <p> * Each object is passed through the transformer as it is added to the * Buffer. It is important not to use the original buffer after invoking this * method, as it is a backdoor for adding untransformed objects. * * @param buffer the buffer to predicate, must not be null * @param transformer the transformer for the buffer, must not be null * @return a transformed buffer backed by the given buffer * @throws IllegalArgumentException if the Buffer or Transformer is null */ public static Buffer transformedBuffer(Buffer buffer, Transformer transformer) { return TransformedBuffer.decorate(buffer, transformer); }
/** * Factory method to create a transforming buffer. * <p> * If there are any elements already in the buffer being decorated, they * are NOT transformed. * * @param buffer the buffer to decorate, must not be null * @param transformer the transformer to use for conversion, must not be null * @return a new transformed Buffer * @throws IllegalArgumentException if buffer or transformer is null */ public static Buffer decorate(Buffer buffer, Transformer transformer) { return new TransformedBuffer(buffer, transformer); }
public Object get() { return getBuffer().get(); }
public Object remove() { return getBuffer().remove(); }
/** * Returns a transformed buffer backed by the given buffer. * <p> * Each object is passed through the transformer as it is added to the * Buffer. It is important not to use the original buffer after invoking this * method, as it is a backdoor for adding untransformed objects. * * @param buffer the buffer to predicate, must not be null * @param transformer the transformer for the buffer, must not be null * @return a transformed buffer backed by the given buffer * @throws IllegalArgumentException if the Buffer or Transformer is null */ public static Buffer transformedBuffer(Buffer buffer, Transformer transformer) { return TransformedBuffer.decorate(buffer, transformer); }
/** * Factory method to create a transforming buffer. * <p> * If there are any elements already in the buffer being decorated, they * are NOT transformed. * * @param buffer the buffer to decorate, must not be null * @param transformer the transformer to use for conversion, must not be null * @return a new transformed Buffer * @throws IllegalArgumentException if buffer or transformer is null */ public static Buffer decorate(Buffer buffer, Transformer transformer) { return new TransformedBuffer(buffer, transformer); }
public Object get() { return getBuffer().get(); }
public void testTransformedBuffer() { Buffer buffer = TransformedBuffer.decorate(new ArrayStack(), TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER); assertEquals(0, buffer.size()); Object[] els = new Object[] {"1", "3", "5", "7", "2", "4", "6"}; for (int i = 0; i < els.length; i++) { buffer.add(els[i]); assertEquals(i + 1, buffer.size()); assertEquals(true, buffer.contains(new Integer((String) els[i]))); assertEquals(false, buffer.contains(els[i])); } assertEquals(false, buffer.remove(els[0])); assertEquals(true, buffer.remove(new Integer((String) els[0]))); } }
/** * Factory method to create a transforming buffer. * <p> * If there are any elements already in the buffer being decorated, they * are NOT transformed. * * @param buffer the buffer to decorate, must not be null * @param transformer the transformer to use for conversion, must not be null * @return a new transformed Buffer * @throws IllegalArgumentException if buffer or transformer is null */ public static Buffer decorate(Buffer buffer, Transformer transformer) { return new TransformedBuffer(buffer, transformer); }
public Object remove() { return getBuffer().remove(); }
/** * Returns a transformed buffer backed by the given buffer. * <p> * Each object is passed through the transformer as it is added to the * Buffer. It is important not to use the original buffer after invoking this * method, as it is a backdoor for adding untransformed objects. * * @param buffer the buffer to predicate, must not be null * @param transformer the transformer for the buffer, must not be null * @return a transformed buffer backed by the given buffer * @throws IllegalArgumentException if the Buffer or Transformer is null */ public static Buffer transformedBuffer(Buffer buffer, Transformer transformer) { return TransformedBuffer.decorate(buffer, transformer); }
/** * Factory method to create a transforming buffer. * <p> * If there are any elements already in the buffer being decorated, they * are NOT transformed. * * @param buffer the buffer to decorate, must not be null * @param transformer the transformer to use for conversion, must not be null * @return a new transformed Buffer * @throws IllegalArgumentException if buffer or transformer is null */ public static Buffer decorate(Buffer buffer, Transformer transformer) { return new TransformedBuffer(buffer, transformer); }
public Object get() { return getBuffer().get(); }
/** * Returns a transformed buffer backed by the given buffer. * <p> * Each object is passed through the transformer as it is added to the * Buffer. It is important not to use the original buffer after invoking this * method, as it is a backdoor for adding untransformed objects. * * @param buffer the buffer to predicate, must not be null * @param transformer the transformer for the buffer, must not be null * @return a transformed buffer backed by the given buffer * @throws IllegalArgumentException if the Buffer or Transformer is null */ public static Buffer transformedBuffer(Buffer buffer, Transformer transformer) { return TransformedBuffer.decorate(buffer, transformer); }
/** * Factory method to create a transforming buffer. * <p> * If there are any elements already in the buffer being decorated, they * are NOT transformed. * * @param buffer the buffer to decorate, must not be null * @param transformer the transformer to use for conversion, must not be null * @return a new transformed Buffer * @throws IllegalArgumentException if buffer or transformer is null */ public static Buffer decorate(Buffer buffer, Transformer transformer) { return new TransformedBuffer(buffer, transformer); }
public Object get() { return getBuffer().get(); }
/** * Returns a transformed buffer backed by the given buffer. * <p> * Each object is passed through the transformer as it is added to the * Buffer. It is important not to use the original buffer after invoking this * method, as it is a backdoor for adding untransformed objects. * * @param buffer the buffer to predicate, must not be null * @param transformer the transformer for the buffer, must not be null * @return a transformed buffer backed by the given buffer * @throws IllegalArgumentException if the Buffer or Transformer is null */ public static Buffer transformedBuffer(Buffer buffer, Transformer transformer) { return TransformedBuffer.decorate(buffer, transformer); }
/** * Factory method to create a transforming buffer. * <p> * If there are any elements already in the buffer being decorated, they * are NOT transformed. * * @param buffer the buffer to decorate, must not be null * @param transformer the transformer to use for conversion, must not be null * @return a new transformed Buffer * @throws IllegalArgumentException if buffer or transformer is null */ public static Buffer decorate(Buffer buffer, Transformer transformer) { return new TransformedBuffer(buffer, transformer); }
public Object remove() { return getBuffer().remove(); }
/** * Returns a transformed buffer backed by the given buffer. * <p> * Each object is passed through the transformer as it is added to the * Buffer. It is important not to use the original buffer after invoking this * method, as it is a backdoor for adding untransformed objects. * * @param buffer the buffer to predicate, must not be null * @param transformer the transformer for the buffer, must not be null * @return a transformed buffer backed by the given buffer * @throws IllegalArgumentException if the Buffer or Transformer is null */ public static Buffer transformedBuffer(Buffer buffer, Transformer transformer) { return TransformedBuffer.decorate(buffer, transformer); }