Package io.vavr.collection
Class HashArrayMappedTrieModule.AbstractNode<K,V>
- java.lang.Object
-
- io.vavr.collection.HashArrayMappedTrieModule.AbstractNode<K,V>
-
- Type Parameters:
K
- Key typeV
- Value type
- All Implemented Interfaces:
HashArrayMappedTrie<K,V>
,java.lang.Iterable<Tuple2<K,V>>
- Direct Known Subclasses:
HashArrayMappedTrieModule.ArrayNode
,HashArrayMappedTrieModule.EmptyNode
,HashArrayMappedTrieModule.IndexedNode
,HashArrayMappedTrieModule.LeafNode
- Enclosing interface:
- HashArrayMappedTrieModule
public abstract static class HashArrayMappedTrieModule.AbstractNode<K,V> extends java.lang.Object implements HashArrayMappedTrie<K,V>
An abstract base class for nodes of a HAMT.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static int
BUCKET_SIZE
(package private) static int
MAX_INDEX_NODE
(package private) static int
MIN_ARRAY_NODE
(package private) static int
SIZE
-
Constructor Summary
Constructors Constructor Description AbstractNode()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
containsKey(K key)
(package private) static int
fromBitmap(int bitmap, int bit)
Option<V>
get(K key)
V
getOrElse(K key, V defaultValue)
(package private) static int
hashFragment(int shift, int hash)
(package private) static java.lang.Object[]
insert(java.lang.Object[] arr, int index, java.lang.Object newElem)
Iterator<Tuple2<K,V>>
iterator()
Iterator<K>
keysIterator()
Provide unboxed access to the keys in the trie.(package private) abstract Option<V>
lookup(int shift, int keyHash, K key)
(package private) abstract V
lookup(int shift, int keyHash, K key, V defaultValue)
(package private) abstract HashArrayMappedTrieModule.AbstractNode<K,V>
modify(int shift, int keyHash, K key, V value, HashArrayMappedTrieModule.Action action)
(package private) Iterator<HashArrayMappedTrieModule.LeafNode<K,V>>
nodes()
HashArrayMappedTrie<K,V>
put(K key, V value)
(package private) static java.lang.Object[]
remove(java.lang.Object[] arr, int index)
HashArrayMappedTrie<K,V>
remove(K key)
(package private) static int
toBitmap(int hash)
java.lang.String
toString()
(package private) static java.lang.Object[]
update(java.lang.Object[] arr, int index, java.lang.Object newElement)
Iterator<V>
valuesIterator()
Provide unboxed access to the values in the trie.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.vavr.collection.HashArrayMappedTrie
isEmpty, size
-
-
-
-
Field Detail
-
SIZE
static final int SIZE
- See Also:
- Constant Field Values
-
BUCKET_SIZE
static final int BUCKET_SIZE
- See Also:
- Constant Field Values
-
MAX_INDEX_NODE
static final int MAX_INDEX_NODE
- See Also:
- Constant Field Values
-
MIN_ARRAY_NODE
static final int MIN_ARRAY_NODE
- See Also:
- Constant Field Values
-
-
Method Detail
-
hashFragment
static int hashFragment(int shift, int hash)
-
toBitmap
static int toBitmap(int hash)
-
fromBitmap
static int fromBitmap(int bitmap, int bit)
-
update
static java.lang.Object[] update(java.lang.Object[] arr, int index, java.lang.Object newElement)
-
remove
static java.lang.Object[] remove(java.lang.Object[] arr, int index)
-
insert
static java.lang.Object[] insert(java.lang.Object[] arr, int index, java.lang.Object newElem)
-
modify
abstract HashArrayMappedTrieModule.AbstractNode<K,V> modify(int shift, int keyHash, K key, V value, HashArrayMappedTrieModule.Action action)
-
nodes
Iterator<HashArrayMappedTrieModule.LeafNode<K,V>> nodes()
-
iterator
public Iterator<Tuple2<K,V>> iterator()
- Specified by:
iterator
in interfaceHashArrayMappedTrie<K,V>
- Specified by:
iterator
in interfacejava.lang.Iterable<K>
-
keysIterator
public Iterator<K> keysIterator()
Description copied from interface:HashArrayMappedTrie
Provide unboxed access to the keys in the trie.- Specified by:
keysIterator
in interfaceHashArrayMappedTrie<K,V>
-
valuesIterator
public Iterator<V> valuesIterator()
Description copied from interface:HashArrayMappedTrie
Provide unboxed access to the values in the trie.- Specified by:
valuesIterator
in interfaceHashArrayMappedTrie<K,V>
-
getOrElse
public V getOrElse(K key, V defaultValue)
- Specified by:
getOrElse
in interfaceHashArrayMappedTrie<K,V>
-
containsKey
public boolean containsKey(K key)
- Specified by:
containsKey
in interfaceHashArrayMappedTrie<K,V>
-
put
public HashArrayMappedTrie<K,V> put(K key, V value)
- Specified by:
put
in interfaceHashArrayMappedTrie<K,V>
-
remove
public HashArrayMappedTrie<K,V> remove(K key)
- Specified by:
remove
in interfaceHashArrayMappedTrie<K,V>
-
toString
public final java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-