Class PathParentIterator
java.lang.Object
org.apache.zookeeper.server.watch.PathParentIterator
Iterates over a ZooKeeper path. Each iteration goes up one parent path. Thus, the
effect of the iterator is to iterate over the initial path and then all of its parents.
-
Method Summary
Modifier and TypeMethodDescriptionReturn an Iterable view so that this Iterator can be used in for each statements.booleanReturns true if this iterator is currently at a parent path as opposed to the initial path given to the constructorstatic PathParentIteratorReturn a new PathParentIterator that iterates from the given path to all parents.static PathParentIteratorforPathOnly(String path) Return a new PathParentIterator that only returns the given path - i.e.booleanhasNext()next()voidremove()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemaining
-
Method Details
-
forAll
Return a new PathParentIterator that iterates from the given path to all parents.- Parameters:
path- initial path
-
forPathOnly
Return a new PathParentIterator that only returns the given path - i.e. does not iterate to parent paths.- Parameters:
path- initial path
-
asIterable
Return an Iterable view so that this Iterator can be used in for each statements. IMPORTANT: the returned Iterable is single use only- Returns:
- Iterable
-
hasNext
public boolean hasNext() -
atParentPath
public boolean atParentPath()Returns true if this iterator is currently at a parent path as opposed to the initial path given to the constructor- Returns:
- true/false
-
next
-
remove
public void remove()
-