@Test public void testNext() throws Exception { }
@Override public TreeNode<T> next() { if (selfHasNext()) { if (lastSelfResult instanceof MutableTreeNode) { childIterator = new DepthTreeIterator<T>(((MutableTreeNode<T>) lastSelfResult).getOwnChildrenIterator(), depth + 1); } else if (lastSelfResult != null) { childIterator = new DepthTreeIterator<T>(lastSelfResult.getOwnChildren(), depth + 1); } else { throw new ConcurrentModificationException("Tree iterator is not tread safe!"); } } if (childrenHasNext()) { lastSelfResult = null; if (this.childIterator != null) { return this.childIterator.next(); } else { throw new ConcurrentModificationException("Tree iterator is not tread safe!"); } } else { childIterator = null; lastSelfResult = iterator.next(); return lastSelfResult; } }
DepthTreeIterator implements TreeIterator<T> { @Override public TreeNode<T> next() { if (selfHasNext()) { if (lastSelfResult instanceof MutableTreeNode) { childIterator = new DepthTreeIterator<T>(((MutableTreeNode<T>) lastSelfResult).getOwnChildrenIterator(), depth + 1); } else if (lastSelfResult != null) { childIterator = new DepthTreeIterator<T>(lastSelfResult.getOwnChildren(), depth + 1); } else { throw new ConcurrentModificationException("Tree iterator is not tread safe!"); } } if (childrenHasNext()) { lastSelfResult = null; if (this.childIterator != null) { return this.childIterator.next(); } else { throw new ConcurrentModificationException("Tree iterator is not tread safe!"); } } else { childIterator = null; lastSelfResult = iterator.next(); return lastSelfResult; } } }
DepthTreeIterator implements TreeIterator<T> { @Override public TreeNode<T> next() { if (selfHasNext()) { if (lastSelfResult instanceof MutableTreeNode) { childIterator = new DepthTreeIterator<T>(((MutableTreeNode<T>) lastSelfResult).getOwnChildrenIterator(), depth + 1); } else if (lastSelfResult != null) { childIterator = new DepthTreeIterator<T>(lastSelfResult.getOwnChildren(), depth + 1); } else { throw new ConcurrentModificationException("Tree iterator is not tread safe!"); } } if (childrenHasNext()) { lastSelfResult = null; if (this.childIterator != null) { return this.childIterator.next(); } else { throw new ConcurrentModificationException("Tree iterator is not tread safe!"); } } else { childIterator = null; lastSelfResult = iterator.next(); return lastSelfResult; } } DepthTreeIterator(@Nonnull TreeNode<T> root);   DepthTreeIterator(@Nonnull Tree<T> tree);   DepthTreeIterator(@Nonnull Collection<? extends TreeNode<T>> nodes); private  DepthTreeIterator(@Nonnull Collection<? extends TreeNode<T>> nodes, int depth); private  DepthTreeIterator(@Nonnull Iterator<? extends TreeNode<T>> iterator, int depth); }
DepthTreeIterator implements TreeIterator<T> { @Override public TreeNode<T> next() { if (selfHasNext()) { if (lastSelfResult instanceof MutableTreeNode) { childIterator = new DepthTreeIterator<T>(((MutableTreeNode<T>) lastSelfResult).getOwnChildrenIterator(), depth + 1); } else if (lastSelfResult != null) { childIterator = new DepthTreeIterator<T>(lastSelfResult.getOwnChildren(), depth + 1); } else { throw new ConcurrentModificationException("Tree iterator is not tread safe!"); } } if (childrenHasNext()) { lastSelfResult = null; if (this.childIterator != null) { return this.childIterator.next(); } else { throw new ConcurrentModificationException("Tree iterator is not tread safe!"); } } else { childIterator = null; lastSelfResult = iterator.next(); return lastSelfResult; } } DepthTreeIterator(@Nonnull TreeNode<T> root);   DepthTreeIterator(@Nonnull Tree<T> tree);   DepthTreeIterator(@Nonnull Collection<? extends TreeNode<T>> nodes); private  DepthTreeIterator(@Nonnull Collection<? extends TreeNode<T>> nodes, int depth); private  DepthTreeIterator(@Nonnull Iterator<? extends TreeNode<T>> iterator, int depth); @Override boolean hasNext(); @Override TreeNode<T> next(); @Override int getDepth(); @Override void remove(); }
DepthTreeIterator implements TreeIterator<T> { @Override public TreeNode<T> next() { if (selfHasNext()) { if (lastSelfResult instanceof MutableTreeNode) { childIterator = new DepthTreeIterator<T>(((MutableTreeNode<T>) lastSelfResult).getOwnChildrenIterator(), depth + 1); } else if (lastSelfResult != null) { childIterator = new DepthTreeIterator<T>(lastSelfResult.getOwnChildren(), depth + 1); } else { throw new ConcurrentModificationException("Tree iterator is not tread safe!"); } } if (childrenHasNext()) { lastSelfResult = null; if (this.childIterator != null) { return this.childIterator.next(); } else { throw new ConcurrentModificationException("Tree iterator is not tread safe!"); } } else { childIterator = null; lastSelfResult = iterator.next(); return lastSelfResult; } } DepthTreeIterator(@Nonnull TreeNode<T> root);   DepthTreeIterator(@Nonnull Tree<T> tree);   DepthTreeIterator(@Nonnull Collection<? extends TreeNode<T>> nodes); private  DepthTreeIterator(@Nonnull Collection<? extends TreeNode<T>> nodes, int depth); private  DepthTreeIterator(@Nonnull Iterator<? extends TreeNode<T>> iterator, int depth); @Override boolean hasNext(); @Override TreeNode<T> next(); @Override int getDepth(); @Override void remove();  }