public static <NodeType> List<NodeType> getNodes(
      final IIterableGraph<NodeType> graph, final INodeFilter<NodeType> filter) {
    Preconditions.checkNotNull(graph, "Error: Graph argument can't be null");
    Preconditions.checkNotNull(filter, "Error: Filter argument can't be null");

    final ArrayList<NodeType> nodes = new ArrayList<NodeType>();

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

            return IterationMode.CONTINUE;
          }
        });

    return nodes;
  }
Returns all nodes in the graph that pass a filter check.

@param <NodeType> Type of the nodes in the graph.
@param graph The graph in question.
@return A list of all nodes in the graph that pass the filter check.
java/zylib/src/main/java/com/google/security/zynamics/zylib/gui/zygraph/helpers/GraphHelpers.java