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
This commit is contained in:
parent
e17ccdb819
commit
91796da5b2
|
@ -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;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue