private boolean conditionMatches(@NotNull TokenPredicatesCondition cond, @NotNull Deque<TokenEntry> head, @NotNull Deque<TokenEntry> tail) {
        boolean tailMatch = false;
        for (List<TokenEntry> condTail : cond.getSuffixes()) {
            int condTailLen = condTail.size();
            if (condTailLen <= tail.size()) {
                boolean matched = true;
                Iterator<TokenEntry> it = tail.descendingIterator();
                for (int i = condTailLen - 1; i >= 0; i--) {
                    if (!it.next().matches(condTail.get(i))) {
                        matched = false;
                        break;
                    }
                }
                if (matched) {
                    tailMatch = true;
                    break;
                }
            }
        }

        if (!tailMatch) {
            return false;
        }

        boolean headMatch = false;
        for (List<TokenEntry> condHead : cond.getPrefixes()) {
            int condHeadLen = condHead.size();
            if (condHeadLen <= head.size()) {
                boolean matched = true;
                Iterator<TokenEntry> it = head.iterator();
                for (int i = 0; i < condHeadLen; i++) {
                    if (!it.next().matches(condHead.get(i))) {
                        matched = false;
                        break;
                    }
                }
                if (matched) {
                    headMatch = true;
                    break;
                }
            }
        }

        return headMatch;
    }
Plain list of token predicate conditions for a comparison with trie-based predicates set
test/org.jkiss.dbeaver.test.platform/src/org/jkiss/dbeaver/model/sql/parser/TokenPredicatesList.java