Package org.atlanmod.commons.collect
Class SizedIterator<E>
- java.lang.Object
-
- org.atlanmod.commons.collect.SizedIterator<E>
-
- Type Parameters:
E- the type of elements returned by this iterator
- All Implemented Interfaces:
Iterator<E>
@ParametersAreNonnullByDefault public class SizedIterator<E> extends Object implements Iterator<E>
A size-basedIteratorthat loads each value with aIntFunction.
-
-
Constructor Summary
Constructors Constructor Description SizedIterator(int size, IntFunction<E> mappingFunction)Constructs a newSizedIterator.SizedIterator(int size, IntFunction<E> mappingFunction, int index)Constructs a newSizedIterator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanhasNext()Enext()voidremove()-
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
-
-
-
-
Constructor Detail
-
SizedIterator
public SizedIterator(@Nonnegative int size, IntFunction<E> mappingFunction)Constructs a newSizedIterator.- Parameters:
size- the size of the iteratormappingFunction- the function used to retrieve the value at a specified index
-
SizedIterator
public SizedIterator(@Nonnegative int size, IntFunction<E> mappingFunction, @Nonnegative int index)Constructs a newSizedIterator.- Parameters:
size- the size of the iteratormappingFunction- the function used to retrieve the value at a specified indexindex- the starting index
-
-