org.javimmutable.collections.tree
Class EmptyNode<K,V>

java.lang.Object
  extended by org.javimmutable.collections.tree.TreeNode<K,V>
      extended by org.javimmutable.collections.tree.EmptyNode<K,V>
All Implemented Interfaces:
Cursorable<JImmutableMap.Entry<K,V>>

@Immutable
public class EmptyNode<K,V>
extends TreeNode<K,V>


Method Summary
 void addEntriesTo(Collection<JImmutableMap.Entry<K,V>> collection)
          Adds this node's value and all of its children's value to the collection.
 Cursor<JImmutableMap.Entry<K,V>> cursor()
          Returns a Cursor visiting all entries in sorted order.
 Holder<V> find(Comparator<K> props, K key)
          Return a (possibly empty) Holder containing the value matching key.
 Holder<JImmutableMap.Entry<K,V>> findEntry(Comparator<K> props, K key)
          Return a (possibly empty) Holder containing the an Entry matching key.
 V getValueOr(Comparator<K> props, K key, V defaultValue)
          Return the value matching key or defaultValue if no match is found.
 boolean isEmpty()
          Return true if this node contains no children or value.
static
<K,V> EmptyNode<K,V>
of()
           
 
Methods inherited from class org.javimmutable.collections.tree.TreeNode
assign, delete
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

of

public static <K,V> EmptyNode<K,V> of()

getValueOr

public V getValueOr(Comparator<K> props,
                    K key,
                    V defaultValue)
Description copied from class: TreeNode
Return the value matching key or defaultValue if no match is found. Searches this node and its appropriate children.

Specified by:
getValueOr in class TreeNode<K,V>
Returns:

find

public Holder<V> find(Comparator<K> props,
                      K key)
Description copied from class: TreeNode
Return a (possibly empty) Holder containing the value matching key. Searches this node and its appropriate children.

Specified by:
find in class TreeNode<K,V>
Returns:

findEntry

public Holder<JImmutableMap.Entry<K,V>> findEntry(Comparator<K> props,
                                                  K key)
Description copied from class: TreeNode
Return a (possibly empty) Holder containing the an Entry matching key. Searches this node and its appropriate children.

Specified by:
findEntry in class TreeNode<K,V>
Returns:

addEntriesTo

public void addEntriesTo(Collection<JImmutableMap.Entry<K,V>> collection)
Description copied from class: TreeNode
Adds this node's value and all of its children's value to the collection.

Specified by:
addEntriesTo in class TreeNode<K,V>

cursor

@Nonnull
public Cursor<JImmutableMap.Entry<K,V>> cursor()
Description copied from class: TreeNode
Returns a Cursor visiting all entries in sorted order.

Specified by:
cursor in interface Cursorable<JImmutableMap.Entry<K,V>>
Specified by:
cursor in class TreeNode<K,V>

isEmpty

public boolean isEmpty()
Description copied from class: TreeNode
Return true if this node contains no children or value.

Overrides:
isEmpty in class TreeNode<K,V>
Returns:


Copyright © 2014 Burton Computer Corporation. All rights reserved.