6473148: TreePath.iterator() should document the iteration order

Reviewed-by: mcimadamore
This commit is contained in:
Vicente Romero 2013-06-28 13:20:44 +01:00
parent 95e39e6039
commit e8952a4764

View File

@ -125,18 +125,25 @@ public class TreePath implements Iterable<Tree> {
return parent; return parent;
} }
/**
* Iterates from leaves to root.
*/
@Override
public Iterator<Tree> iterator() { public Iterator<Tree> iterator() {
return new Iterator<Tree>() { return new Iterator<Tree>() {
@Override
public boolean hasNext() { public boolean hasNext() {
return next != null; return next != null;
} }
@Override
public Tree next() { public Tree next() {
Tree t = next.leaf; Tree t = next.leaf;
next = next.parent; next = next.parent;
return t; return t;
} }
@Override
public void remove() { public void remove() {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }