Package com.saperion.util
Class IteratorIterable<Type>
- java.lang.Object
-
- com.saperion.util.IteratorIterable<Type>
-
- All Implemented Interfaces:
java.lang.Iterable<Type>
public class IteratorIterable<Type> extends java.lang.Object implements java.lang.Iterable<Type>For a givenIteratoranIteratorIterableis a correspondingIterable- and thus usable in the extended for-syntax.
-
-
Constructor Summary
Constructors Constructor Description IteratorIterable(java.util.Iterator<Type> iterator)Creates a newIteratorIterablefor the givenIterator
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <Type> IteratorIterable<Type>create(java.util.Iterator<Type> iterator)For a givenIteratorthis method returns anIterablewhoseIterable.iterator()will return exactly that iterator.java.util.Iterator<Type>iterator()
-
-
-
Constructor Detail
-
IteratorIterable
public IteratorIterable(java.util.Iterator<Type> iterator)
Creates a newIteratorIterablefor the givenIterator- Parameters:
iterator- the iterator to iterate. Must not be null.
-
-
Method Detail
-
iterator
public java.util.Iterator<Type> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<Type>
-
create
public static <Type> IteratorIterable<Type> create(java.util.Iterator<Type> iterator)
For a givenIteratorthis method returns anIterablewhoseIterable.iterator()will return exactly that iterator.- Type Parameters:
Type- The generic type of theIterator. The whole point of this method is to make the compiler determine this type.- Parameters:
iterator- theIteratorto create anIterablefor. Must not be null.- Returns:
- an
IterablewhoseIterable.iterator()will return the givenIterator.
-
-