Class LinesSequence
A sequence that loops over lines from a File, Path, or BufferedReader.
-
Field Summary
Fields inherited from class ste.lloop.AbstractSequence
indexes -
Constructor Summary
ConstructorsConstructorDescriptionLinesSequence(BufferedReader reader) Creates a new sequence for the given BufferedReader.LinesSequence(File file) Creates a new sequence for the given File.LinesSequence(Path path) Creates a new sequence for the given Path. -
Method Summary
Modifier and TypeMethodDescription<R> Rloop(BiConsumer<Integer, String> consumer) Executes the given consumer for each element in the loop.Methods inherited from class ste.lloop.ForwardOnlySequence
from, loop, step, to
-
Constructor Details
-
LinesSequence
Creates a new sequence for the given File.- Parameters:
file- the File to loop over- Throws:
IllegalArgumentException- if the file is null, does not exist, is a directory, or is not readable.
-
LinesSequence
Creates a new sequence for the given Path.- Parameters:
path- the Path to loop over- Throws:
IllegalArgumentException- if the path is null, does not exist, is a directory, or is not readable.
-
LinesSequence
Creates a new sequence for the given BufferedReader.- Parameters:
reader- the BufferedReader to loop over
-
-
Method Details
-
loop
Description copied from class:ForwardOnlySequenceExecutes the given consumer for each element in the loop.If the array provided to the constructor was
null, this method will do nothing.- Specified by:
loopin classForwardOnlySequence<String>- Type Parameters:
R- the type of the return value- Parameters:
consumer- the consumer to execute for each element- Returns:
- the value passed to
Loop._break_(Object...), ornullif the loop completes without a_break_
-