Package org.apache.sis.util.collection
Class DerivedIterator<S,E>
java.lang.Object
org.apache.sis.util.collection.DerivedIterator<S,E>
- Type Parameters:
S
- the type of elements in the storage collection.E
- the type of elements in this set.
- All Implemented Interfaces:
Iterator<E>
An iterator which performs conversions on the fly using the given converter.
If a value is converted into a null value, then this iterator skips that value.
Consequently, this iterator cannot return null value.
- Since:
- 0.3
- Version:
- 0.3
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDerivedIterator
(Iterator<S> iterator, ObjectConverter<S, E> converter) Creates a new iterator wrapping the given original iterator and converting the values using the given converter. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Iterator
forEachRemaining
-
Field Details
-
iterator
The original iterator to wrap. -
converter
The converter from the original values to the converted values. -
next
The next element to be returned, ornull
.
-
-
Constructor Details
-
DerivedIterator
DerivedIterator(Iterator<S> iterator, ObjectConverter<S, E> converter) Creates a new iterator wrapping the given original iterator and converting the values using the given converter.
-
-
Method Details
-
hasNext
public boolean hasNext()Returnstrue
if the iteration has more elements. -
next
Returns the next element in the iteration. -
remove
public void remove()Removes from the underlying set the last element returned by the iterator.- Specified by:
remove
in interfaceIterator<S>
- Throws:
UnsupportedOperationException
- if the underlying collection doesn't supports theremove
operation.
-