mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-21 11:34:38 +02:00
6473148: TreePath.iterator() should document the iteration order
Reviewed-by: mcimadamore
This commit is contained in:
parent
95e39e6039
commit
e8952a4764
1 changed files with 7 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue