Buggy code:
public final class Graph < E > { private final Map < E , Graph . Node < E > > nodes ; private final Set < Graph . Node < E > > roots ; private final ReentrantLock lock ; private transient int modcount ; public Graph ( ) { } public boolean contains ( E element ) { } public void clear ( ) { } public boolean add ( E element ) { } public void remove ( E element ) { } public void removeAll ( Collection < E > elements ) { } public void addChildren ( E element , Set < E > newChildren ) { } public boolean hasChild ( E parent , E potentialChild ) { } private Predicate < ? super Graph . Node < E > > is ( final E element ) { } public Set < E > getDirectParents ( E element ) { } public Set < E > getTreeFrom ( E root ) { } public Set < E > getTreeFrom ( E root , Set < E > endPoints ) { } public Set < E > getSubgraphContaining ( E element ) { } public Set < E > getSubgraphContaining ( E element , Set < E > endPoints ) { } public PruningIterator < E > breadthFirstIterator ( ) { } public E getParentData ( E element ) { } public void addParentData ( E element , E parentData ) { } private static class Node < K > { private final K element ; private K parentData ; private final Set < Graph . Node < K > > children ; private final Set < Graph . Node < K > > parents ; public Node ( K element ) { } public Set < Graph . Node < K > > getChildren ( ) { } public Set < Graph . Node < K > > getParents ( ) { } public Iterable < Graph . Node < K > > getAllParents ( ) { } public void connectChild ( Graph . Node < K > child ) { } public void breakConnections ( ) { } public K getElement ( ) { } public K getParentData ( ) { } public void setParentData ( K parentData ) { } } private static class SubgraphBuilder < L > { protected final Set < L > set ; protected final Set < L > endPoints ; private final Graph . Node < L > start ; public SubgraphBuilder ( Graph . Node < L > start , Set < L > endPoints ) { } public Set < L > buildSubgraph ( ) { } public Set < L > buildTree ( ) { } private class NodeIterator implements Iterator < L > { private final Iterator < Graph . Node < L > > nodesIterator ; private Iterator < L > nextNodeIterator ; private L next ; public NodeIterator ( Graph . Node < L > node ) { } protected Iterator < Graph . Node < L > > createConnectedNodesIterator ( Graph . Node < L > node ) { } public boolean hasNext ( ) { <START_BUG> return ( ( ( next ) != null ) || ( nextNodeIterator . hasNext ( ) ) ) || ( nodesIterator . hasNext ( ) ) ; <END_BUG> } public L next ( ) { } public void remove ( ) { } private void prepareNext ( ) { } private void prepareNextIterator ( ) { } } } private static class ParentsIterable < O > implements Iterable < Graph . Node < O > > { private final Graph . Node < O > start ; public ParentsIterable ( Graph . Node < O > start ) { } public Iterator < Graph . Node < O > > iterator ( ) { } } private static class ParentsIterator < P > extends AbstractTreeIterator < Graph . Node < P > > { private static final long serialVersionUID = - 4476850344598138970L ; public ParentsIterator ( Graph . Node < P > start ) { } @ SuppressWarnings ( "unchecked" ) @ Override protected Iterator < ? extends Graph . Node < P > > getChildren ( Object obj ) { } } private class BreadthFirstIterator implements PruningIterator < E > { private Iterator < Graph . Node < E > > currentIterator ; private Set < Graph . Node < E > > nextIterable ; private Set < Graph . Node < E > > consumedNodes ; private Graph . Node < E > lastReturned ; private Graph . Node < E > next ; private int expectedModCount ; public BreadthFirstIterator ( ) { } public boolean hasNext ( ) { return ( ( ( next ) != null ) || ( currentIterator . hasNext ( ) ) ) || ( ! ( consumedNodes . containsAll ( nextIterable ) ) ) ; } public E next ( ) { } public void prune ( ) { } public void remove ( ) { } private void prepareNext ( ) { } private void prepareNextIterator ( ) { } } }

Fix:
return ( ( next ) != null ) || ( nextNodeIterator . hasNext ( ) ) ;