Class RedBlackTreeModule.Empty<T>
java.lang.Object
io.vavr.collection.RedBlackTreeModule.Empty<T>
- Type Parameters:
T- Component type
- All Implemented Interfaces:
RedBlackTree<T>, Serializable, Iterable<T>
- Enclosing interface:
RedBlackTreeModule
public static final class RedBlackTreeModule.Empty<T>
extends Object
implements RedBlackTree<T>, Serializable
The empty tree node. It can't be a singleton because it depends on a
Comparator.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface RedBlackTree
RedBlackTree.Color -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncolor()Return theRedBlackTree.Colorof this Red/Black Tree node.Returns the underlyingComparatorof this RedBlackTree.booleanChecks, if thisRedBlackTreecontains the givenvalue.Returns the empty instance of this RedBlackTree.Finds the value stored in this tree, if exists, by applying the underlying comparator to the tree elements and the given element.booleanisEmpty()Checks if thisRedBlackTreeis empty, i.e.left()Returns the left child if this is a non-empty node, otherwise throws.right()Returns the right child if this is a non-empty node, otherwise throws.intsize()Returns the size of this tree.toString()Returns a Lisp like representation of this tree.value()Returns the value of the current tree node or throws if this is empty.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Iterable
forEach, spliteratorMethods inherited from interface RedBlackTree
delete, difference, insert, intersection, iterator, max, min, union
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
comparator
-
-
Constructor Details
-
Empty
Empty(Comparator<? super T> comparator)
-
-
Method Details
-
color
Description copied from interface:RedBlackTreeReturn theRedBlackTree.Colorof this Red/Black Tree node.An empty node is
BLACKby definition.- Specified by:
colorin interfaceRedBlackTree<T>- Returns:
- Either
REDorBLACK.
-
comparator
Description copied from interface:RedBlackTreeReturns the underlyingComparatorof this RedBlackTree.- Specified by:
comparatorin interfaceRedBlackTree<T>- Returns:
- The comparator.
-
contains
Description copied from interface:RedBlackTreeChecks, if thisRedBlackTreecontains the givenvalue.- Specified by:
containsin interfaceRedBlackTree<T>- Parameters:
value- A value.- Returns:
- true, if this tree contains the value, false otherwise.
-
emptyInstance
Description copied from interface:RedBlackTreeReturns the empty instance of this RedBlackTree.- Specified by:
emptyInstancein interfaceRedBlackTree<T>- Returns:
- An empty ReadBlackTree
-
find
Description copied from interface:RedBlackTreeFinds the value stored in this tree, if exists, by applying the underlying comparator to the tree elements and the given element.Especially the value returned may differ from the given value, even if the underlying comparator states that both are equal.
- Specified by:
findin interfaceRedBlackTree<T>- Parameters:
value- A value- Returns:
- Some value, if this tree contains a value equal to the given value according to the underlying comparator. Otherwise None.
-
isEmpty
public boolean isEmpty()Description copied from interface:RedBlackTreeChecks if thisRedBlackTreeis empty, i.e. an instance ofLeaf.- Specified by:
isEmptyin interfaceRedBlackTree<T>- Returns:
- true, if it is empty, false otherwise.
-
left
Description copied from interface:RedBlackTreeReturns the left child if this is a non-empty node, otherwise throws.- Specified by:
leftin interfaceRedBlackTree<T>- Returns:
- The left child.
-
right
Description copied from interface:RedBlackTreeReturns the right child if this is a non-empty node, otherwise throws.- Specified by:
rightin interfaceRedBlackTree<T>- Returns:
- The right child.
-
size
public int size()Description copied from interface:RedBlackTreeReturns the size of this tree.- Specified by:
sizein interfaceRedBlackTree<T>- Returns:
- the number of nodes of this tree and 0 if this is the empty tree
-
value
Description copied from interface:RedBlackTreeReturns the value of the current tree node or throws if this is empty.- Specified by:
valuein interfaceRedBlackTree<T>- Returns:
- The value.
-
toString
Description copied from interface:RedBlackTreeReturns a Lisp like representation of this tree.- Specified by:
toStringin interfaceRedBlackTree<T>- Overrides:
toStringin classObject- Returns:
- This Tree as Lisp like String.
-