public static <NodeType>Collection<NodeType> collectNodes(final Collection<? extends NodeType> nodes,final INodeFilter<NodeType> filter){
  Preconditions.checkNotNull(nodes,"Error: Nodes argument can't be null");
  Preconditions.checkNotNull(filter,"Error: Filter argument can't be null");
  final Collection<NodeType> filteredNodes=new ArrayList<NodeType>();
  for (  final NodeType child : nodes) {
    if (filter.qualifies(child)) {
      filteredNodes.add(child);
    }
  }
  return filteredNodes;
}

public static < NodeType > Collection < NodeType > collectNodes ( final Collection < ? extends NodeType > nodes , final INodeFilter < NodeType > filter ) { Preconditions . checkNotNull ( nodes , "Error: Nodes argument can't be null" ) ; Preconditions . checkNotNull ( filter , "Error: Filter argument can't be null" ) ; final Collection < NodeType > filteredNodes = new ArrayList < NodeType > ( ) ; for ( final NodeType child : nodes ) { if ( filter . qualifies ( child ) ) { filteredNodes . add ( child ) ; } } return filteredNodes ; }
filters all nodes from a list of nodes that pass a filter check .
