@Test public void testNext() { Scanner scanner = new Scanner(Collections.<CharSequence>singletonList("foo bar"), 0, 4); assertEquals('b', scanner.peek()); scanner.next(); assertEquals('a', scanner.peek()); scanner.next(); assertEquals('r', scanner.peek()); scanner.next(); assertEquals('\0', scanner.peek()); }
public void next() { index++; if (index > lineLength) { lineIndex++; if (lineIndex < lines.size()) { setLine(lines.get(lineIndex)); } else { setLine(""); } index = 0; } }
Scanner { public void next() { index++; if (index > lineLength) { lineIndex++; if (lineIndex < lines.size()) { setLine(lines.get(lineIndex)); } else { setLine(""); } index = 0; } } }
Scanner { public void next() { index++; if (index > lineLength) { lineIndex++; if (lineIndex < lines.size()) { setLine(lines.get(lineIndex)); } else { setLine(""); } index = 0; } } Scanner(List<CharSequence> lines, int lineIndex, int index); }
Scanner { public void next() { index++; if (index > lineLength) { lineIndex++; if (lineIndex < lines.size()) { setLine(lines.get(lineIndex)); } else { setLine(""); } index = 0; } } Scanner(List<CharSequence> lines, int lineIndex, int index); static Scanner of(List<CharSequence> lines); static Scanner of(CharSequence line); char peek(); char peekPrevious(); boolean hasNext(); void next(); boolean next(char c); boolean next(String content); int matchMultiple(char c); int match(CharMatcher matcher); int whitespace(); int find(char c); int find(CharMatcher matcher); Position position(); void setPosition(Position position); CharSequence textBetween(Position begin, Position end); }
Scanner { public void next() { index++; if (index > lineLength) { lineIndex++; if (lineIndex < lines.size()) { setLine(lines.get(lineIndex)); } else { setLine(""); } index = 0; } } Scanner(List<CharSequence> lines, int lineIndex, int index); static Scanner of(List<CharSequence> lines); static Scanner of(CharSequence line); char peek(); char peekPrevious(); boolean hasNext(); void next(); boolean next(char c); boolean next(String content); int matchMultiple(char c); int match(CharMatcher matcher); int whitespace(); int find(char c); int find(CharMatcher matcher); Position position(); void setPosition(Position position); CharSequence textBetween(Position begin, Position end); static final char END; }