@SafeVarargs
    private static <T1, T2> boolean containsTailElements(final List<T1> items,
                                                         final Function<T1, T2> mapper,
                                                         final T2... requiredTailTypes) {
        if (NullSafe.isEmptyArray(requiredTailTypes)) {
            return false;
        } else if (NullSafe.isEmptyCollection(items)) {
            return false;
        } else if (requiredTailTypes.length > items.size()) {
            return false;
        } else {
            int listIdx = items.size() - 1;
            boolean isMatch = true;
            Objects.requireNonNull(mapper);
            for (int arrIdx = requiredTailTypes.length - 1; arrIdx >= 0; arrIdx--) {
                final T1 item = items.get(listIdx);
                final T2 mappedItem = mapper.apply(item);
                if (!Objects.equals(requiredTailTypes[arrIdx], mappedItem)) {
                    isMatch = false;
                    break;
                }
                listIdx--;
            }
            return isMatch;
        }
    }
Here to help testing, so we don't have to work out the row/col postitions
stroom-query/stroom-query-impl/src/main/java/stroom/query/impl/QueryServiceImpl.java