|
6 | 6 | import java.util.Map; |
7 | 7 | import java.util.function.Supplier; |
8 | 8 |
|
| 9 | +/** |
| 10 | + * A {@link StringMultiTrie} that allows customization of nodes' backing data structures. |
| 11 | + * |
| 12 | + * @param <V> the type of values |
| 13 | + * |
| 14 | + * @see #of(Supplier, Supplier) |
| 15 | + * @see #createHashed() |
| 16 | + */ |
9 | 17 | public final class CompositeStringMultiTrie<V> extends StringMultiTrie<V, CompositeStringMultiTrie.Branch<V>> { |
10 | 18 | private final Root<V> root; |
11 | 19 | private final View view = new View(); |
12 | 20 |
|
| 21 | + /** |
| 22 | + * Creates a trie with nodes whose branches are held in {@link HashMap}s |
| 23 | + * and whose leaves are held in {@link HashSet}s. |
| 24 | + * |
| 25 | + * @param <V> the type of values stored in the created trie |
| 26 | + * |
| 27 | + * @see #of(Supplier, Supplier) |
| 28 | + */ |
13 | 29 | public static <V> CompositeStringMultiTrie<V> createHashed() { |
14 | 30 | return of(HashMap::new, HashSet::new); |
15 | 31 | } |
16 | 32 |
|
| 33 | + /** |
| 34 | + * Creates a trie with nodes whose branches are held in maps created by the passed {@code branchesFactory} |
| 35 | + * and whose leaves are held in collections created by the passed {@code leavesFactory}. |
| 36 | + * |
| 37 | + * @param branchesFactory a pure method that creates a new, empty {@link Map} in which to hold branch nodes |
| 38 | + * @param leavesFactory a pure method that create a new, empty {@link Collection} in which to hold leaf values |
| 39 | + * |
| 40 | + * @param <V> the type of values stored in the created trie |
| 41 | + * |
| 42 | + * @see #createHashed() |
| 43 | + */ |
17 | 44 | public static <V> CompositeStringMultiTrie<V> of( |
18 | 45 | Supplier<Map<Character, Branch<V>>> branchesFactory, |
19 | 46 | Supplier<Collection<V>> leavesFactory |
|
0 commit comments