@Test public void lookAhead() { LineSequence originalLineSequence = LineSequence.create("one\ntwo"); PredicateLineSequence lineSequence = new PredicateLineSequence(originalLineSequence, notTwoPredicate()); LineSequence lookAhead = lineSequence.lookAhead(); assertEquals("one", lookAhead.getCurrentLine().getText()); assertNull(lookAhead.getNextLine()); lookAhead.advance(); assertNull(lookAhead.getCurrentLine()); assertNull(lookAhead.getNextLine()); assertEquals("one", lineSequence.getCurrentLine().getText()); }
@Override public LineSequence lookAhead() { return new PredicateLineSequence(delegate.lookAhead(), predicate); }
PredicateLineSequence extends LineSequence { @Override public LineSequence lookAhead() { return new PredicateLineSequence(delegate.lookAhead(), predicate); } }
PredicateLineSequence extends LineSequence { @Override public LineSequence lookAhead() { return new PredicateLineSequence(delegate.lookAhead(), predicate); } PredicateLineSequence(LineSequence delegate, Predicate<Line> predicate); }
PredicateLineSequence extends LineSequence { @Override public LineSequence lookAhead() { return new PredicateLineSequence(delegate.lookAhead(), predicate); } PredicateLineSequence(LineSequence delegate, Predicate<Line> predicate); @Override Line getCurrentLine(); @Override Line getNextLine(); @Override void advance(); @Override LineSequence lookAhead(); }
PredicateLineSequence extends LineSequence { @Override public LineSequence lookAhead() { return new PredicateLineSequence(delegate.lookAhead(), predicate); } PredicateLineSequence(LineSequence delegate, Predicate<Line> predicate); @Override Line getCurrentLine(); @Override Line getNextLine(); @Override void advance(); @Override LineSequence lookAhead();  }