You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ki...@apache.org on 2013/11/13 18:06:01 UTC

svn commit: r1541614 - /commons/proper/functor/trunk/core/src/main/java/org/apache/commons/functor/generator/util/CollectionTransformer.java

Author: kinow
Date: Wed Nov 13 17:06:01 2013
New Revision: 1541614

URL: http://svn.apache.org/r1541614
Log:
Update Javadoc for CollectionTransformer

Modified:
    commons/proper/functor/trunk/core/src/main/java/org/apache/commons/functor/generator/util/CollectionTransformer.java

Modified: commons/proper/functor/trunk/core/src/main/java/org/apache/commons/functor/generator/util/CollectionTransformer.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/core/src/main/java/org/apache/commons/functor/generator/util/CollectionTransformer.java?rev=1541614&r1=1541613&r2=1541614&view=diff
==============================================================================
--- commons/proper/functor/trunk/core/src/main/java/org/apache/commons/functor/generator/util/CollectionTransformer.java (original)
+++ commons/proper/functor/trunk/core/src/main/java/org/apache/commons/functor/generator/util/CollectionTransformer.java Wed Nov 13 17:06:01 2013
@@ -23,8 +23,7 @@ import org.apache.commons.functor.genera
 import org.apache.commons.lang3.Validate;
 
 /**
- * Transforms a generator into a collection. If a collection is not passed into
- * the constructor an ArrayList will be returned from the transform method.
+ * Transforms a generator into a collection.
  *
  * @param <E> the type of elements held in the adapted collection.
  * @param <C> the type of the adapted collection
@@ -32,13 +31,6 @@ import org.apache.commons.lang3.Validate
  * @version $Revision$ $Date$
  */
 public class CollectionTransformer<E, C extends Collection<? super E>> implements Function<Generator<? extends E>, C> {
-    /*
-     * TODO revisit this class... it could stand a more-descriptive name.  Also, it's a little
-     * hard to say whether, for an instance constructed without a specific target collection,
-     * #evaluate() should return a new ArrayList for each call, or continue adding to
-     * a single ArrayList instance (the current behavior).
-     * Perhaps this is more a documentation issue than anything.
-     */
 
     // instance methods
     //---------------------------------------------------
@@ -52,6 +44,7 @@ public class CollectionTransformer<E, C 
     /**
      * Create a new CollectionTransformer.
      * @param toFill Collection to fill
+     * @throws NullPointerException if the collection is {@code null}
      */
     public CollectionTransformer(C toFill) {
         this.toFill = Validate.notNull(toFill, "toFill");
@@ -60,7 +53,10 @@ public class CollectionTransformer<E, C 
     // instance methods
     //---------------------------------------------------
     /**
-     * {@inheritDoc}
+     * Run the {@link Generator} adding each element produced into the
+     * collection.
+     * @param generator the generator
+     * @return the C collection filled with the elements produced by the generator
      */
     public C evaluate(Generator<? extends E> generator) {
         generator.run(new Procedure<E>() {