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.io.Serializable,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.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static intBUCKET_SIZE(package private) static intMAX_INDEX_NODE(package private) static intMIN_ARRAY_NODEprivate static longserialVersionUID(package private) static intSIZE
-
Constructor Summary
Constructors Constructor Description AbstractNode()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleancontainsKey(K key)(package private) static intfromBitmap(int bitmap, int bit)Option<V>get(K key)VgetOrElse(K key, V defaultValue)(package private) static inthashFragment(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 Vlookup(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 inttoBitmap(int hash)java.lang.StringtoString()(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
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
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:
iteratorin interfaceHashArrayMappedTrie<K,V>- Specified by:
iteratorin interfacejava.lang.Iterable<K>
-
keysIterator
public Iterator<K> keysIterator()
Description copied from interface:HashArrayMappedTrieProvide unboxed access to the keys in the trie.- Specified by:
keysIteratorin interfaceHashArrayMappedTrie<K,V>
-
valuesIterator
public Iterator<V> valuesIterator()
Description copied from interface:HashArrayMappedTrieProvide unboxed access to the values in the trie.- Specified by:
valuesIteratorin interfaceHashArrayMappedTrie<K,V>
-
getOrElse
public V getOrElse(K key, V defaultValue)
- Specified by:
getOrElsein interfaceHashArrayMappedTrie<K,V>
-
containsKey
public boolean containsKey(K key)
- Specified by:
containsKeyin interfaceHashArrayMappedTrie<K,V>
-
put
public HashArrayMappedTrie<K,V> put(K key, V value)
- Specified by:
putin interfaceHashArrayMappedTrie<K,V>
-
remove
public HashArrayMappedTrie<K,V> remove(K key)
- Specified by:
removein interfaceHashArrayMappedTrie<K,V>
-
toString
public final java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-