Class EditingIntIterator
java.lang.Object
com.github.tommyettinger.ds.support.util.EditingIntIterator
- All Implemented Interfaces:
IntIterator,Iterator<Integer>
Wraps an Iterator so that it calls a function on each item it would otherwise return, and returns that function's
result.
If you need to return a different type than what the iterator returns, you can use an
You can change both the Iterator and editor at once using
AlteringIterator.
This has undefined behavior if any items the Iterator could return are modified during iteration.
You can change both the Iterator and editor at once using
set(IntIterator, IntToIntFunction) ,
and can also just change the Iterator with set(IntIterator).-
Field Summary
FieldsModifier and TypeFieldDescriptioncom.github.tommyettinger.function.IntToIntFunction -
Constructor Summary
ConstructorsConstructorDescriptionEditingIntIterator(IntIterator iterator, com.github.tommyettinger.function.IntToIntFunction editor) -
Method Summary
Modifier and TypeMethodDescriptionbooleanhasNext()intnextInt()Returns the nextintelement in the iteration.voidremove()voidset(IntIterator iterator) voidset(IntIterator iterator, com.github.tommyettinger.function.IntToIntFunction editor) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.github.tommyettinger.ds.support.util.IntIterator
forEachRemaining, nextMethods inherited from interface java.util.Iterator
forEachRemaining
-
Field Details
-
iterator
-
editor
public com.github.tommyettinger.function.IntToIntFunction editor
-
-
Constructor Details
-
EditingIntIterator
public EditingIntIterator() -
EditingIntIterator
public EditingIntIterator(IntIterator iterator, com.github.tommyettinger.function.IntToIntFunction editor)
-
-
Method Details
-
set
-
set
-
hasNext
public boolean hasNext() -
nextInt
public int nextInt()Description copied from interface:IntIteratorReturns the nextintelement in the iteration.- Specified by:
nextIntin interfaceIntIterator- Returns:
- the next
intelement in the iteration
-
remove
public void remove()
-