revert IteratorUtils stuff; toList() works fine for this--duh git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/collections_jdk5_branch@753392 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/91796da5 Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/91796da5 Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/91796da5 Branch: refs/heads/collections_jdk5_branch Commit: 91796da5b22843acb2e2d72af53fef816ef982ad Parents: e17ccdb Author: Matthew Jason Benson <mben...@apache.org> Authored: Fri Mar 13 20:39:53 2009 +0000 Committer: Matthew Jason Benson <mben...@apache.org> Committed: Fri Mar 13 20:39:53 2009 +0000 ---------------------------------------------------------------------- .../apache/commons/collections/IteratorUtils.java | 16 ---------------- .../commons/collections/TestIteratorUtils.java | 13 ------------- 2 files changed, 29 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-collections/blob/91796da5/src/java/org/apache/commons/collections/IteratorUtils.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/commons/collections/IteratorUtils.java b/src/java/org/apache/commons/collections/IteratorUtils.java index 3d066c2..cefc2d7 100644 --- a/src/java/org/apache/commons/collections/IteratorUtils.java +++ b/src/java/org/apache/commons/collections/IteratorUtils.java @@ -916,20 +916,4 @@ public class IteratorUtils { return singletonIterator(obj); } - /** - * Return an {@link Iterable} so that any {@link Iterator} can be used - * with the "foreach" statement. - * @param <T> element type - * @param iterator to wrap - * @return Iterable<T> - * @since Commons Collections 5 - * @TODO fix version - */ - public static <T> Iterable<T> iterable(final Iterator<T> iterator) { - return new Iterable<T>() { - public Iterator<T> iterator() { - return iterator; - } - }; - } } http://git-wip-us.apache.org/repos/asf/commons-collections/blob/91796da5/src/test/org/apache/commons/collections/TestIteratorUtils.java ---------------------------------------------------------------------- diff --git a/src/test/org/apache/commons/collections/TestIteratorUtils.java b/src/test/org/apache/commons/collections/TestIteratorUtils.java index 6bb142c..dc24155 100644 --- a/src/test/org/apache/commons/collections/TestIteratorUtils.java +++ b/src/test/org/apache/commons/collections/TestIteratorUtils.java @@ -725,17 +725,4 @@ public class TestIteratorUtils extends BulkTest { } } - public void testIterable() throws Exception { - Integer[] array = new Integer[10]; - for (int i = 0; i < array.length; i++) { - array[i] = i; - } - Iterator<Integer> it = Arrays.asList(array).iterator(); - int i = 0; - for (Integer o : IteratorUtils.iterable(it)) { - assertEquals(i, o.intValue()); - i++; - } - assertEquals(i, array.length); - } }