6473148: TreePath.iterator() should document the iteration order
Reviewed-by: mcimadamore
This commit is contained in:
parent
95e39e6039
commit
e8952a4764
@ -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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user