public Matcher next() throws IOException {
  readahead();
  if (matches == null) {
    throw new NoSuchElementException();
  }
  Matcher matcher=matches.next();
  if (discard) {
    Pattern pattern=matcher.pattern();
    for (int n=0; n < patterns.length; n++) {
      if (patterns[n] == pattern) {
        patterns[n]=null;
        break;
      }
    }
  }
  return matcher;
}

public Matcher next ( ) throws IOException { readahead ( ) ; if ( matches == null ) { throw new NoSuchElementException ( ) ; } Matcher matcher = matches . next ( ) ; if ( discard ) { Pattern pattern = matcher . pattern ( ) ; for ( int n = 0 ; n < patterns . length ; n ++ ) { if ( patterns [ n ] == pattern ) { patterns [ n ] = null ; break ; } } } return matcher ; }
returns the next match from the character stream . matches are returned in the order they are encountered in the character stream , then by the order they are expressed in the supplied patterns collection .
