ConcurrentSuffixTree implements SuffixTree<O>, PrettyPrintable, Serializable { @Override public int size() { return valueMap.size(); } ConcurrentSuffixTree(NodeFactory nodeFactory); @Override O put(CharSequence key, O value); @Override O putIfAbsent(CharSequence key, O value); @Override boolean remove(CharSequence key); @Override O getValueForExactKey(CharSequence key); @Override Iterable<CharSequence> getKeysEndingWith(CharSequence suffix); @Override Iterable<O> getValuesForKeysEndingWith(final CharSequence suffix); @Override Iterable<KeyValuePair<O>> getKeyValuePairsForKeysEndingWith(final CharSequence suffix); @Override Iterable<CharSequence> getKeysContaining(final CharSequence fragment); @Override Iterable<O> getValuesForKeysContaining(final CharSequence fragment); @Override Iterable<KeyValuePair<O>> getKeyValuePairsForKeysContaining(final CharSequence fragment); @Override int size(); @Override Node getNode();  }
@Test public void testSize() { ConcurrentSuffixTree<Integer> tree = newConcurrentSuffixTreeForUnitTests(); assertEquals(0, tree.size()); tree.put("TEST", 1); assertEquals(1, tree.size()); tree.put("TEAM", 2); assertEquals(2, tree.size()); tree.put("TOAST", 3); assertEquals(3, tree.size()); tree.remove("FOO"); assertEquals(3, tree.size()); tree.remove("TOAST"); assertEquals(2, tree.size()); tree.remove("TEAM"); assertEquals(1, tree.size()); tree.remove("TEST"); assertEquals(0, tree.size()); }