Пример #1
0
 @Override
 public final T getNext() {
   if (iterator.hasNext()) {
     T item = iterator.next();
     if (predicate.matches(item)) {
       return item;
     }
   }
   return finished();
 }
Пример #2
0
 @Override
 public String toString() {
   return predicate.toString();
 }
Пример #3
0
 @Override
 public Result<Character> parse(final Segment<Character> characters) {
   if (characters.isEmpty()) return fail(predicate, "[EOF]");
   Character c = characters.head();
   return predicate.matches(c) ? success(c, characters.tail()) : fail(predicate, c);
 }