public <T extends ElementType<E>> boolean positiveLookaheadUntil(
        int until,
        T... expected
    ) {
        for (int i = 1; i <= until; i++) {
            for (ElementType<E> type : expected) {
                if (type.isMatchedBy(lookahead(i))) {
                    return true;
                }
            }
        }
        return false;
    }
public < T extends ElementType < E > > boolean positiveLookaheadUntil ( int until , T ... expected ) { for ( int i = 1 ; i <= until ; i ++ ) { for ( ElementType < E > type : expected ) { if ( type . isMatchedBy ( lookahead ( i ) ) ) { return true ; } } } return false ; }
Checks if there is an element in this stream of
the expected types until the specified position.

@param <T> represents the element type of this stream, removes the
"unchecked generic array creation for varargs parameter"
warnings
@param until the position until which to search
@param expected the expected types
@return {@code true} if there is an element of the expected types
until the specified position or {@code false} otherwise