Class EditingByteIterator
java.lang.Object
com.github.tommyettinger.ds.support.util.EditingByteIterator
- All Implemented Interfaces:
ByteIterator,Iterator<Byte>
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(ByteIterator, ByteToByteFunction) ,
and can also just change the Iterator with set(ByteIterator).-
Field Summary
FieldsModifier and TypeFieldDescriptioncom.github.tommyettinger.function.ByteToByteFunction -
Constructor Summary
ConstructorsConstructorDescriptionEditingByteIterator(ByteIterator iterator, com.github.tommyettinger.function.ByteToByteFunction editor) -
Method Summary
Modifier and TypeMethodDescriptionbooleanhasNext()bytenextByte()Returns the nextbyteelement in the iteration.voidremove()voidset(ByteIterator iterator) voidset(ByteIterator iterator, com.github.tommyettinger.function.ByteToByteFunction 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.ByteIterator
forEachRemaining, nextMethods inherited from interface java.util.Iterator
forEachRemaining
-
Field Details
-
iterator
-
editor
public com.github.tommyettinger.function.ByteToByteFunction editor
-
-
Constructor Details
-
EditingByteIterator
public EditingByteIterator() -
EditingByteIterator
public EditingByteIterator(ByteIterator iterator, com.github.tommyettinger.function.ByteToByteFunction editor)
-
-
Method Details
-
set
-
set
-
hasNext
public boolean hasNext() -
nextByte
public byte nextByte()Description copied from interface:ByteIteratorReturns the nextbyteelement in the iteration.- Specified by:
nextBytein interfaceByteIterator- Returns:
- the next
byteelement in the iteration
-
remove
public void remove()
-