public class LineWalker extends Object
peek()" function so that following lines can be checked without modifying the state of the walker,
and a "pushBack(String)" function so that the state can be rolled back (or even falsified) when
required.
This class is not thread-safe.
| Constructor and Description |
|---|
LineWalker(String text) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
hasNext() |
String |
next()
Walks the next line, returning the line and advancing the state of the walker past that line.
|
String |
peek()
Returns the next line to be walked without actually walking it.
|
void |
pushBack(String line) |
public LineWalker(String text)
public boolean hasNext()
public String peek()
hasNext() first.IllegalStateException - if there are no more lines to be walked.public String next()
hasNext() first.IllegalStateException - if there are no more lines to be walked.public void pushBack(String line)
Copyright © 2019 Atlassian. All rights reserved.