Class EditingLongIterator
java.lang.Object
com.github.tommyettinger.ds.support.util.EditingLongIterator
- All Implemented Interfaces:
LongIterator,Iterator<Long>
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(LongIterator, LongToLongFunction) ,
and can also just change the Iterator with set(LongIterator).-
Field Summary
FieldsModifier and TypeFieldDescriptioncom.github.tommyettinger.function.LongToLongFunction -
Constructor Summary
ConstructorsConstructorDescriptionEditingLongIterator(LongIterator iterator, com.github.tommyettinger.function.LongToLongFunction editor) -
Method Summary
Modifier and TypeMethodDescriptionbooleanhasNext()longnextLong()Returns the nextlongelement in the iteration.voidremove()voidset(LongIterator iterator) voidset(LongIterator iterator, com.github.tommyettinger.function.LongToLongFunction 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.LongIterator
forEachRemaining, next
-
Field Details
-
iterator
-
editor
public com.github.tommyettinger.function.LongToLongFunction editor
-
-
Constructor Details
-
EditingLongIterator
public EditingLongIterator() -
EditingLongIterator
public EditingLongIterator(LongIterator iterator, com.github.tommyettinger.function.LongToLongFunction editor)
-
-
Method Details
-
set
-
set
-
hasNext
public boolean hasNext() -
nextLong
public long nextLong()Description copied from interface:LongIteratorReturns the nextlongelement in the iteration.- Specified by:
nextLongin interfaceLongIterator- Returns:
- the next
longelement in the iteration
-
remove
public void remove()
-