Class EditingDoubleIterator
java.lang.Object
com.github.tommyettinger.ds.support.util.EditingDoubleIterator
- All Implemented Interfaces:
DoubleIterator,Iterator<Double>
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(DoubleIterator, DoubleToDoubleFunction) ,
and can also just change the Iterator with set(DoubleIterator).-
Field Summary
FieldsModifier and TypeFieldDescriptioncom.github.tommyettinger.function.DoubleToDoubleFunction -
Constructor Summary
ConstructorsConstructorDescriptionEditingDoubleIterator(DoubleIterator iterator, com.github.tommyettinger.function.DoubleToDoubleFunction editor) -
Method Summary
Modifier and TypeMethodDescriptionbooleanhasNext()doubleReturns the nextdoubleelement in the iteration.voidremove()voidset(DoubleIterator iterator) voidset(DoubleIterator iterator, com.github.tommyettinger.function.DoubleToDoubleFunction 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.DoubleIterator
forEachRemaining, nextMethods inherited from interface java.util.Iterator
forEachRemaining
-
Field Details
-
iterator
-
editor
public com.github.tommyettinger.function.DoubleToDoubleFunction editor
-
-
Constructor Details
-
EditingDoubleIterator
public EditingDoubleIterator() -
EditingDoubleIterator
public EditingDoubleIterator(DoubleIterator iterator, com.github.tommyettinger.function.DoubleToDoubleFunction editor)
-
-
Method Details
-
set
public void set(DoubleIterator iterator, com.github.tommyettinger.function.DoubleToDoubleFunction editor) -
set
-
hasNext
public boolean hasNext() -
nextDouble
public double nextDouble()Description copied from interface:DoubleIteratorReturns the nextdoubleelement in the iteration.- Specified by:
nextDoublein interfaceDoubleIterator- Returns:
- the next
doubleelement in the iteration
-
remove
public void remove()
-