@FunctionalInterface
public interface CharIterable
extends java.lang.Iterable<java.lang.Character>
Modifier and Type | Method and Description |
---|---|
default java.io.Reader |
asReader() |
default void |
forEach(java.util.function.Consumer<? super java.lang.Character> consumer)
Perform the given action for each
char in this iterable. |
default void |
forEachChar(CharConsumer consumer)
Perform the given action for each
char in this iterable. |
static CharIterable |
from(java.lang.Character... characters) |
static CharIterable |
from(java.lang.Iterable<java.lang.Character> iterable) |
CharIterator |
iterator() |
static CharIterable |
of(char... characters) |
static CharIterable |
once(CharIterator iterator) |
static CharIterable |
read(java.io.Reader reader)
Create a
CharIterable from a Reader which iterates over the characters provided in the reader. |
static CharIterable read(java.io.Reader reader)
CharIterable
from a Reader
which iterates over the characters provided in the reader.
The Reader
must support Reader.reset()
or the CharIterable
will only be available to
iterate over once. The Reader
will be reset in between iterations, if possible. If an
IOException
occurs during iteration, an IterationException
will be thrown. The Reader
will not be closed by the CharIterable
when iteration finishes, it must be closed externally when
iteration is finished.CharIterator iterator()
iterator
in interface java.lang.Iterable<java.lang.Character>
default void forEach(java.util.function.Consumer<? super java.lang.Character> consumer)
char
in this iterable.forEach
in interface java.lang.Iterable<java.lang.Character>
default void forEachChar(CharConsumer consumer)
char
in this iterable.static CharIterable of(char... characters)
static CharIterable from(java.lang.Character... characters)
static CharIterable from(java.lang.Iterable<java.lang.Character> iterable)
static CharIterable once(CharIterator iterator)
default java.io.Reader asReader()
CharIterable
as a Reader
. Mark and reset is supported, by re-traversing
the iterator to the mark position.