Class CollectionTransformer<E>

  • Type Parameters:
    E - the type of elements held in the adapted collection.
    All Implemented Interfaces:
    Functor, UnaryFunction<Generator<? extends E>,​java.util.Collection<? super E>>, UnaryFunctor<Generator<? extends E>>

    public class CollectionTransformer<E>
    extends java.lang.Object
    implements UnaryFunction<Generator<? extends E>,​java.util.Collection<? super E>>
    Transforms a generator into a collection. If a collection is not passed into the constructor an ArrayList will be returned from the transform method.
    Since:
    1.0
    Version:
    $Revision$ $Date$
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.Collection<? super E> toFill
      The adapted collection has to be filled.
    • Constructor Summary

      Constructors 
      Constructor Description
      CollectionTransformer()
      Create a new CollectionTransformer.
      CollectionTransformer​(java.util.Collection<? super E> toFill)
      Create a new CollectionTransformer.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Collection<E> evaluate​(Generator<? extends E> generator)
      Evaluate this function.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • toFill

        private final java.util.Collection<? super E> toFill
        The adapted collection has to be filled.
    • Constructor Detail

      • CollectionTransformer

        public CollectionTransformer()
        Create a new CollectionTransformer.
      • CollectionTransformer

        public CollectionTransformer​(java.util.Collection<? super E> toFill)
        Create a new CollectionTransformer.
        Parameters:
        toFill - Collection to fill
    • Method Detail

      • evaluate

        public java.util.Collection<E> evaluate​(Generator<? extends E> generator)
        Evaluate this function.
        Specified by:
        evaluate in interface UnaryFunction<Generator<? extends E>,​java.util.Collection<? super E>>
        Parameters:
        generator - the A object to evaluate
        Returns:
        the T result of this evaluation