Class GridIterableAdapter<T>
- java.lang.Object
-
- org.apache.ignite.internal.util.lang.GridIterableAdapter<T>
-
- All Implemented Interfaces:
Serializable,Iterable<T>,Iterator<T>,GridSerializableIterator<T>,GridIterable<T>,GridIterator<T>
public class GridIterableAdapter<T> extends Object implements GridIterable<T>
Convenient adapter for "rich" iterable interface.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classGridIterableAdapter.IteratorWrapper<T>
-
Constructor Summary
Constructors Constructor Description GridIterableAdapter(Iterator<T> impl)Creates adapter with given iterator implementation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanhasNext()booleanhasNextX()This method is the same asIterator.hasNext(), but allows for failure with exception.GridIterator<T>iterator()ReturnsGridIteratorwhich extends regularIteratorinterface and adds methods that account for possible failures in cases when iterating over data that has been partially received over network.Tnext()TnextX()This method is the same asIterator.next(), but allows for failure with exception.voidremove()voidremoveX()This method is the same asIterator.remove(), but allows for failure with exception.StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface java.util.Iterator
forEachRemaining
-
-
-
-
Method Detail
-
iterator
public GridIterator<T> iterator()
ReturnsGridIteratorwhich extends regularIteratorinterface and adds methods that account for possible failures in cases when iterating over data that has been partially received over network.- Specified by:
iteratorin interfaceGridIterable<T>- Specified by:
iteratorin interfaceIterable<T>- Returns:
- Instance of new
GridIterator.
-
hasNextX
public boolean hasNextX() throws IgniteCheckedExceptionThis method is the same asIterator.hasNext(), but allows for failure with exception. Often iterators are used to iterate through values that have not or have partially been received from remote nodes, and need to account for possible network failures, rather than just returningfalseout ofIterator.hasNext()method.- Specified by:
hasNextXin interfaceGridIterator<T>- Returns:
Trueif iterator contains more elements.- Throws:
IgniteCheckedException- If no more elements can be returned due to some failure, like a network error for example.- See Also:
Iterator.hasNext()
-
nextX
public T nextX() throws IgniteCheckedException
This method is the same asIterator.next(), but allows for failure with exception. Often iterators are used to iterate through values that have not or have partially been received from remote nodes, and need to account for possible network failures, rather than throwingNoSuchElementExceptionruntime exception.s- Specified by:
nextXin interfaceGridIterator<T>- Returns:
Trueif iterator contains more elements.- Throws:
IgniteCheckedException- If no more elements can be returned due to some failure, like a network error for example.- See Also:
Iterator.next()
-
removeX
public void removeX() throws IgniteCheckedExceptionThis method is the same asIterator.remove(), but allows for failure with exception.- Specified by:
removeXin interfaceGridIterator<T>- Throws:
IgniteCheckedException- If failed.
-
-