Libraryless. Click here for Pure Java version (3091L/19K).
svoid test_StringTrie() { Map<S, Int> map = littreemap("hello" := 1, "hella" := 2); StringTrie<Int> trie = asStringTrie(map); assertEquals(map, trie.asMap()); print(trie); assertEquals(littreeset("hell"), trie.childStrings()); // add in different order, check again trie = new StringTrie; trie.add("hello" := 1); trie.add("hella" := 2); assertEquals(map, trie.asMap()); print(trie); assertEquals(littreeset("hell"), trie.childStrings()); map.put("hell" := 3); assertEquals(map, asStringTrie(map).asMap()); map = litcimap("HE" := 1, "hello" := 2); assertEquals(map, assertCIMap(asStringTrie(map).asMap())); print(asStringTrie(map)); map = litmap("" := 5, "bla" := 6); assertEquals(map, asStringTrie(map).asMap()); print(asStringTrie(map)); }
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt
No comments. add comment
Snippet ID: | #1030156 |
Snippet name: | test_StringTrie [OK] |
Eternal ID of this version: | #1030156/11 |
Text MD5: | 9bbb5b439b8dcca135c41f7e526e2522 |
Transpilation MD5: | 77bdcf18094934dac5d275b950110987 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-11-11 22:28:35 |
Source code size: | 819 bytes / 26 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 193 / 328 |
Version history: | 10 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |