public boolean canConsume( String[] nextTokens ) throws IllegalStateException {
        if (completed) return false;
        ListIterator<Token> iter = tokens.listIterator(tokenIterator.previousIndex());
        Token token = null;
        for (String nextExpected : nextTokens) {
            if (!iter.hasNext()) return false;
            token = iter.next();
            if (nextExpected == ANY_VALUE) continue;
            if (!token.matches(nextExpected)) return false;
        }
        this.tokenIterator = iter;
        this.currentToken = tokenIterator.hasNext() ? tokenIterator.next() : null;
        this.completed = this.currentToken == null;
        return true;
    }
public boolean canConsume ( String [ ] nextTokens ) throws IllegalStateException { if ( completed ) return false ; ListIterator < Token > iter = tokens . listIterator ( tokenIterator . previousIndex ( ) ) ; Token token = null ; for ( String nextExpected : nextTokens ) { if ( ! iter . hasNext ( ) ) return false ; token = iter . next ( ) ; if ( nextExpected == ANY_VALUE ) continue ; if ( ! token . matches ( nextExpected ) ) return false ; } this . tokenIterator = iter ; this . currentToken = tokenIterator . hasNext ( ) ? tokenIterator . next ( ) : null ; this . completed = this . currentToken == null ; return true ; }
Attempt to consume this current token and the next tokens if and only if they match the expected values, and return whether
this method was indeed able to consume all of the supplied tokens.
<p>
This is <i>not</i> the same as calling {@link #canConsume(String)} for each of the supplied arguments, since this method
ensures that <i>all</i> of the supplied values can be consumed.
</p>
<p>
This method <i>is</i> equivalent to calling the following:

<pre>

if (tokens.matches(currentExpected, expectedForNextTokens)) {
tokens.consume(currentExpected, expectedForNextTokens);
}

</pre>

</p>
<p>
The {@link #ANY_VALUE ANY_VALUE} constant can be used in the expected values as a wildcard.
</p>

@param nextTokens the expected values of the next tokens
@return true if the current token did match and was consumed, or false if the current token did not match and therefore was
not consumed
@throws IllegalStateException if this method was called before the stream was {@link #start() started}