public static <NodeType> List<NodeType> filter(
      final IIterableCollection<INodeCallback<NodeType>> graph,
      final ICollectionFilter<NodeType> filter) {
    final List<NodeType> items = new ArrayList<NodeType>();

    graph.iterate(
        new INodeCallback<NodeType>() {
          @Override
          public IterationMode next(final NodeType node) {
            if (filter.qualifies(node)) {
              items.add(node);
            }

            return IterationMode.CONTINUE;
          }
        });

    return items;
  }
Returns a list of nodes that match the given filter.

@param <NodeType> Type of the nodes in the graph.
@param graph The graph that provides the nodes.
@param filter The filter that selects the nodes.
@return The list of nodes that passes the filter.
java/zylib/src/main/java/com/google/security/zynamics/zylib/gui/zygraph/helpers/GraphHelpers.java