Package io.activej.inject.util
Class Trie<K,V>
java.lang.Object
io.activej.inject.util.Trie<K,V>
Completely generic and abstract simple Java implementation
of the prefixed tree (or trie) data structure.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcomputeIfAbsent(K[] path, Function<K, V> f) computeIfAbsent(K key, Function<K, V> f) voidvoiddfs(K[] path, BiConsumer<K[], V> consumer) booleanget()getOrDefault(K key, V defaultValue) inthashCode()static <K,V> Trie<K, V> leaf(V value) static <K,V> Trie<K, V> merge(BiConsumer<V, V> merger, V rootPayload, Trie<K, V> first, Trie<K, V> second) static <K,V> Trie<K, V> merge(BiConsumer<V, V> merger, V rootPayload, Trie<K, V> first, Trie<K, V> second, Trie<K, V>... rest) static <K,V> Trie<K, V> merge(BiConsumer<V, V> merger, V rootPayload, Collection<Trie<K, V>> bindings) static <K,V> Trie<K, V> merge(BiConsumer<V, V> merger, V rootPayload, Stream<Trie<K, V>> bindings) static <K,V> Trie<K, V> toString()
-
Constructor Details
-
Trie
-
-
Method Details
-
leaf
-
of
-
get
-
getChildren
-
get
-
getOrDefault
-
computeIfAbsent
-
get
-
computeIfAbsent
-
addAll
-
map
-
dfs
-
dfs
-
merge
public static <K,V> Trie<K,V> merge(BiConsumer<V, V> merger, V rootPayload, Trie<K, V> first, Trie<K, V> second) -
merge
@SafeVarargs public static <K,V> Trie<K,V> merge(BiConsumer<V, V> merger, V rootPayload, Trie<K, V> first, Trie<K, V> second, Trie<K, V>... rest) -
merge
public static <K,V> Trie<K,V> merge(BiConsumer<V, V> merger, V rootPayload, Collection<Trie<K, V>> bindings) -
merge
public static <K,V> Trie<K,V> merge(BiConsumer<V, V> merger, V rootPayload, Stream<Trie<K, V>> bindings) -
prettyPrint
-
toString
-
equals
-
hashCode
public int hashCode()
-