ConcurrentReversedRadixTree implements ReversedRadixTree<O>, PrettyPrintable, Serializable { @Override public O put(CharSequence key, O value) { return radixTree.put(CharSequences.reverse(key), value); } ConcurrentReversedRadixTree(NodeFactory nodeFactory); @Override O getValueForExactKey(CharSequence key); @Override O put(CharSequence key, O value); @Override O putIfAbsent(CharSequence key, O value); @Override Iterable<CharSequence> getKeysEndingWith(CharSequence suffix); @Override Iterable<O> getValuesForKeysEndingWith(CharSequence suffix); @Override Iterable<KeyValuePair<O>> getKeyValuePairsForKeysEndingWith(CharSequence suffix); @Override boolean remove(CharSequence key); @Override int size(); @Override Node getNode();  }
@Test public void testPut() throws Exception { ConcurrentReversedRadixTree<Integer> tree = new ConcurrentReversedRadixTree<Integer>(getNodeFactory()); tree.put("TEST", 1); tree.put("TEAM", 2); tree.put("TOAST", 3); String expected = "○\n" + "├── ○ MAET (2)\n" + "└── ○ TS\n" + " ├── ○ AOT (3)\n" + " └── ○ ET (1)\n"; String actual = PrettyPrinter.prettyPrint(tree); assertEquals(expected, actual); }
@Test public void testSerialization() { ConcurrentReversedRadixTree<Integer> tree1 = new ConcurrentReversedRadixTree<Integer>(getNodeFactory()); tree1.put("TEST", 1); tree1.put("TEAM", 2); tree1.put("TOAST", 3); ConcurrentReversedRadixTree<Integer> tree2 = TestUtility.deserialize(ConcurrentReversedRadixTree.class, TestUtility.serialize(tree1)); assertEquals(PrettyPrinter.prettyPrint(tree1), PrettyPrinter.prettyPrint(tree2)); }