Class EditingCharIterator
java.lang.Object
com.github.tommyettinger.ds.support.util.EditingCharIterator
- All Implemented Interfaces:
CharIterator,Iterator<Character>
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(CharIterator, CharToCharFunction) ,
and can also just change the Iterator with set(CharIterator).-
Field Summary
FieldsModifier and TypeFieldDescriptioncom.github.tommyettinger.function.CharToCharFunction -
Constructor Summary
ConstructorsConstructorDescriptionEditingCharIterator(CharIterator iterator, com.github.tommyettinger.function.CharToCharFunction editor) -
Method Summary
Modifier and TypeMethodDescriptionbooleanhasNext()charnextChar()Returns the nextcharelement in the iteration.voidremove()voidset(CharIterator iterator) voidset(CharIterator iterator, com.github.tommyettinger.function.CharToCharFunction 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.CharIterator
forEachRemaining, nextMethods inherited from interface java.util.Iterator
forEachRemaining
-
Field Details
-
iterator
-
editor
public com.github.tommyettinger.function.CharToCharFunction editor
-
-
Constructor Details
-
EditingCharIterator
public EditingCharIterator() -
EditingCharIterator
public EditingCharIterator(CharIterator iterator, com.github.tommyettinger.function.CharToCharFunction editor)
-
-
Method Details
-
set
-
set
-
hasNext
public boolean hasNext() -
nextChar
public char nextChar()Description copied from interface:CharIteratorReturns the nextcharelement in the iteration.- Specified by:
nextCharin interfaceCharIterator- Returns:
- the next
charelement in the iteration
-
remove
public void remove()
-