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

Fri, 28 Jun 2013 13:20:44 +0100

author
vromero
date
Fri, 28 Jun 2013 13:20:44 +0100
changeset 1871
bb06c412d079
parent 1870
6101e52ce9e3
child 1872
bdd699d7378d

6473148: TreePath.iterator() should document the iteration order
Reviewed-by: mcimadamore

src/share/classes/com/sun/source/util/TreePath.java file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/classes/com/sun/source/util/TreePath.java	Fri Jun 28 06:54:58 2013 -0400
     1.2 +++ b/src/share/classes/com/sun/source/util/TreePath.java	Fri Jun 28 13:20:44 2013 +0100
     1.3 @@ -125,18 +125,25 @@
     1.4          return parent;
     1.5      }
     1.6  
     1.7 +    /**
     1.8 +     *  Iterates from leaves to root.
     1.9 +     */
    1.10 +    @Override
    1.11      public Iterator<Tree> iterator() {
    1.12          return new Iterator<Tree>() {
    1.13 +            @Override
    1.14              public boolean hasNext() {
    1.15                  return next != null;
    1.16              }
    1.17  
    1.18 +            @Override
    1.19              public Tree next() {
    1.20                  Tree t = next.leaf;
    1.21                  next = next.parent;
    1.22                  return t;
    1.23              }
    1.24  
    1.25 +            @Override
    1.26              public void remove() {
    1.27                  throw new UnsupportedOperationException();
    1.28              }

mercurial