@Override
    public <T extends Node> void copyTo(Collection<? super T> collection, NodeType<T> type, QueryOptions filter) {
        if (type == NodeType.INHERITANCE) {
            //noinspection unchecked
            copyInheritanceNodesTo((Collection<? super InheritanceNode>) collection, filter);
            return;
        }
        
        for (Map.Entry<ImmutableContextSet, SortedSet<Node>> e : map().entrySet()) {
            if (!filter.satisfies(e.getKey(), defaultSatisfyMode())) {
                continue;
            }

            if (normalNodesExcludeTest(filter, e.getKey())) {
                continue;
            }

            for (Node node : e.getValue()) {
                if (type.matches(node)) {
                    collection.add(type.cast(node));
                }
            }
        }
    }
Base implementation of {@link NodeMap} query methods.
common/src/main/java/me/lucko/luckperms/common/model/nodemap/NodeMapBase.java