Class EditingShortIterator
java.lang.Object
com.github.tommyettinger.ds.support.util.EditingShortIterator
- All Implemented Interfaces:
ShortIterator,Iterator<Short>
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(ShortIterator, ShortToShortFunction) ,
and can also just change the Iterator with set(ShortIterator).-
Field Summary
FieldsModifier and TypeFieldDescriptioncom.github.tommyettinger.function.ShortToShortFunction -
Constructor Summary
ConstructorsConstructorDescriptionEditingShortIterator(ShortIterator iterator, com.github.tommyettinger.function.ShortToShortFunction editor) -
Method Summary
Modifier and TypeMethodDescriptionbooleanhasNext()shortReturns the nextshortelement in the iteration.voidremove()voidset(ShortIterator iterator) voidset(ShortIterator iterator, com.github.tommyettinger.function.ShortToShortFunction editor) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemainingMethods inherited from interface com.github.tommyettinger.ds.support.util.ShortIterator
forEachRemaining, next
-
Field Details
-
iterator
-
editor
public com.github.tommyettinger.function.ShortToShortFunction editor
-
-
Constructor Details
-
EditingShortIterator
public EditingShortIterator() -
EditingShortIterator
public EditingShortIterator(ShortIterator iterator, com.github.tommyettinger.function.ShortToShortFunction editor)
-
-
Method Details
-
set
public void set(ShortIterator iterator, com.github.tommyettinger.function.ShortToShortFunction editor) -
set
-
hasNext
public boolean hasNext() -
nextShort
public short nextShort()Description copied from interface:ShortIteratorReturns the nextshortelement in the iteration.- Specified by:
nextShortin interfaceShortIterator- Returns:
- the next
shortelement in the iteration
-
remove
public void remove()
-