code: public static <T> T selectFirst(Iterator<T> nodeIterator, Predicate<T> filter)
     {
        while (nodeIterator.hasNext())
        {
           T element = nodeIterator.next();
           if (filter.accept(element))
           {
              return element;
           }
        }
        return null;
     }
docs: Returns the first {@link DependencyNode} object found that satisfy the filter.
  
  @param nodeIterator A tree iterator
  @param filter the {@link DependencyNodeFilter} being used
  @return the first element that matches the filter. null if nothing is found
  
  @see #breadthFirstIterator(DependencyNode)
  @see #depthFirstIterator(DependencyNode)
  @see #preorderIterator(DependencyNode)