Module inet.ipaddr

Interface BinaryTreeNode.CachingIterator<N extends BinaryTreeNode<E>,E,C>

All Superinterfaces:
Iterator<N>
Enclosing class:
BinaryTreeNode<E>

public static interface BinaryTreeNode.CachingIterator<N extends BinaryTreeNode<E>,E,C> extends Iterator<N>
  • Method Details

    • getCached

      C getCached()
      After Iterator.next() has returned a node, if an object was cached by a call to cacheWithLowerSubNode(Object) or cacheWithUpperSubNode(Object) was called when that node's parent was previously returned by Iterator.next(), then this returns that cached object.
      Returns:
      the cached object
    • cacheWithLowerSubNode

      boolean cacheWithLowerSubNode(C object)
      After Iterator.next() has returned a node, calling this method caches the provided object with the lower sub-node so that it can be retrieved with getCached() when the lower sub-node is visited later.

      Returns false if it could not be cached, either because the node has since been removed with a call to Iterator.remove(), because Iterator.next() has not been called yet, or because there is no lower sub node for the node previously returned by Iterator.next().

      The caching and retrieval is done in constant time.

      Parameters:
      object - the object to be retrieved later.
    • cacheWithUpperSubNode

      boolean cacheWithUpperSubNode(C object)
      After Iterator.next() has returned a node, calling this method caches the provided object with the upper sub-node so that it can be retrieved with getCached() when the upper sub-node is visited later.

      Returns false if it could not be cached, either because the node has since been removed with a call to Iterator.remove(), because Iterator.next() has not been called yet, or because there is no upper sub node for the node previously returned by Iterator.next().

      The caching and retrieval is done in constant time.

      Parameters:
      object - the object to be retrieved later.
      Returns: