private static Set<TokenType> set(final Set<TokenType> set) {
        if (NullSafe.isEmptyCollection(set)) {
            return Collections.emptySet();
        } else if (set instanceof EnumSet<TokenType>) {
            return Collections.unmodifiableSet(set);
        } else {
            return Collections.unmodifiableSet(EnumSet.copyOf(set));
        }
    }
@return True if tokenTypes are the last contiguous sequence of {@link TokenType}s
seen at the end of tokenTypeSequence.
stroom-query/stroom-query-api/src/main/java/stroom/query/api/token/TokenType.java