- public Iterator<QNameWithPredicate> iterator() {
- return new Iterator<QNameWithPredicate>() {
- private LeafRefPath current = LeafRefPath.this;
-
- @Override
- public boolean hasNext() {
- return current.parent != null;
- }
-
- @Override
- public QNameWithPredicate next() {
- if (current.parent != null) {
- final QNameWithPredicate ret = current.qname;
- current = current.parent;
- return ret;
- } else {
- throw new NoSuchElementException(
- "No more elements available");
- }
- }
-
- @Override
- public void remove() {
- throw new UnsupportedOperationException(
- "Component removal not supported");
- }
- };
+ public boolean hasNext() {
+ return current.parent != null;
+ }
+
+ @Override
+ public QNameWithPredicate next() {
+ if (current.parent == null) {
+ throw new NoSuchElementException("No more elements available");
+ }
+
+ final QNameWithPredicate ret = current.qname;
+ current = current.parent;
+ return ret;
+ }
+
+ @Override
+ public void remove() {
+ throw new UnsupportedOperationException("Component removal not supported");