TreeNode

Entry for Tree bins. Extends LinkedHashMap.Entry (which in turn extends Node) so can be used as extension of either regular or linked node.

Constructors

this
this(size_t hash, K key, V val, HashMapNode!(K, V) next)
Undocumented in source.

Members

Functions

find
TreeNode!(K, V) find(size_t h, K k)

Finds the node starting at root p with the given hash and key. The kc argument caches comparableClassFor(key) upon first use comparing keys.

getTreeNode
TreeNode!(K, V) getTreeNode(size_t h, K k)

Calls find for root node.

putTreeVal
TreeNode!(K, V) putTreeVal(HashMap!(K, V) map, HashMapNode!(K, V)[] tab, size_t h, K k, V v)

Tree version of putVal.

removeTreeNode
void removeTreeNode(HashMap!(K, V) map, HashMapNode!(K, V)[] tab, bool movable)

Removes the given node, that must be present before this call. This is messier than typical red-black deletion code because we cannot swap the contents of an interior node with a leaf successor that is pinned by "next" pointers that are accessible independently during traversal. So instead we swap the tree linkages. If the current tree appears to have too few nodes, the bin is converted back to a plain bin. (The test triggers somewhere between 2 and 6 nodes, depending on tree structure).

root
TreeNode!(K, V) root()

Returns root of tree containing this node.

split
void split(HashMap!(K, V) map, HashMapNode!(K, V)[] tab, int index, int bit)

Splits nodes in a tree bin into lower and upper tree bins, or untreeifies if now too small. Called only from resize; see above discussion about split bits and indices.

treeify
void treeify(HashMapNode!(K, V)[] tab)

Forms tree of the nodes linked from this node. @return root of tree

untreeify
HashMapNode!(K, V) untreeify(HashMap!(K, V) map)

Returns a list of non-TreeNodes replacing those linked from this node.

Static functions

balanceDeletion
TreeNode!(K, V) balanceDeletion(TreeNode!(K, V) root, TreeNode!(K, V) x)
Undocumented in source. Be warned that the author may not have intended to support it.
balanceInsertion
TreeNode!(K, V) balanceInsertion(TreeNode!(K, V) root, TreeNode!(K, V) x)
Undocumented in source. Be warned that the author may not have intended to support it.
checkInvariants
bool checkInvariants(TreeNode!(K, V) t)

Recursive invariant check

moveRootToFront
void moveRootToFront(HashMapNode!(K, V)[] tab, TreeNode!(K, V) root)

Ensures that the given root is the first node of its bin.

rotateLeft
TreeNode!(K, V) rotateLeft(TreeNode!(K, V) root, TreeNode!(K, V) p)
Undocumented in source. Be warned that the author may not have intended to support it.
rotateRight
TreeNode!(K, V) rotateRight(TreeNode!(K, V) root, TreeNode!(K, V) p)
Undocumented in source. Be warned that the author may not have intended to support it.
tieBreakOrder
int tieBreakOrder(T a, T b)

Tie-breaking utility for ordering insertions when equal hashCodes and non-comparable. We don't require a total order, just a consistent insertion rule to maintain equivalence across rebalancings. Tie-breaking further than necessary simplifies testing a bit.

tieBreakOrder
int tieBreakOrder(T a, T b)
Undocumented in source. Be warned that the author may not have intended to support it.
tieBreakOrder
int tieBreakOrder(T a, T b)
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

UNTREEIFY_THRESHOLD
enum int UNTREEIFY_THRESHOLD;

The bin count threshold for untreeifying a (split) bin during a resize operation. Should be less than TREEIFY_THRESHOLD, and at most 6 to mesh with shrinkage detection under removal.

left
TreeNode!(K, V) left;
Undocumented in source.
parent
TreeNode!(K, V) parent;
Undocumented in source.
prev
TreeNode!(K, V) prev;
Undocumented in source.
red
bool red;
Undocumented in source.
right
TreeNode!(K, V) right;
Undocumented in source.

Meta