commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r1234401 - /commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/generator/util/EachElement.java
Date Sat, 21 Jan 2012 19:14:43 GMT
Author: mbenson
Date: Sat Jan 21 19:14:43 2012
New Revision: 1234401

URL: http://svn.apache.org/viewvc?rev=1234401&view=rev
Log:
[FUNCTOR-13] EachElement supports not specifically Collection but more generally Iterable

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

Modified: commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/generator/util/EachElement.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/generator/util/EachElement.java?rev=1234401&r1=1234400&r2=1234401&view=diff
==============================================================================
--- commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/generator/util/EachElement.java
(original)
+++ commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/generator/util/EachElement.java
Sat Jan 21 19:14:43 2012
@@ -15,7 +15,6 @@
 package org.apache.commons.functor.generator.util;
 
 import java.util.Arrays;
-import java.util.Collection;
 import java.util.Iterator;
 import java.util.Map;
 
@@ -42,13 +41,13 @@ public final class EachElement {
     }
 
     /**
-     * Get a Generator for each element of a Collection.
-     * @param <E> the type of elements held in the input collection.
-     * @param collection to iterate
+     * Get a Generator for each element of an Iterable.
+     * @param <E> the type of elements held in the input iterable.
+     * @param iterable to iterate
      * @return Generator<E>
      */
-    public static <E> Generator<E> from(Collection<? extends E> collection)
{
-        return collection == null ? null : EachElement.from(collection.iterator());
+    public static <E> Generator<E> from(Iterable<? extends E> iterable)
{
+        return iterable == null ? null : EachElement.from(iterable.iterator());
     }
 
     /**
@@ -69,7 +68,7 @@ public final class EachElement {
      * @param array to iterate
      * @return Generator
      */
-    public static <E> Generator<E> from(E[] array) {
+    public static <E> Generator<E> from(E... array) {
         return array == null ? null : EachElement.from(Arrays.asList(array).iterator());
     }
 



Mime
View raw message