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;
}
/**
* Iterates from leaves to root.
*/
@Override
public Iterator<Tree> iterator() {
return new Iterator<Tree>() {
@Override
public boolean hasNext() {
return next != null;
}
@Override
public Tree next() {
Tree t = next.leaf;
next = next.parent;
return t;
}
@Override
public void remove() {
throw new UnsupportedOperationException();
}