/** {@inheritDoc} */ @Override public Set<CharSequence> getKeysContainedIn(CharSequence document) { Iterable<CharSequence> documentSuffixes = CharSequenceUtil.generateSuffixes(document); final Set<CharSequence> results = new LinkedHashSet<CharSequence>(); for (CharSequence documentSuffix : documentSuffixes) { radixTree.scanForKeysAtStartOfInput( documentSuffix, new ConcurrentInvertedRadixTreeImpl.KeyValueHandler() { @Override public void handle(CharSequence key, Object value) { String keyString = CharSequenceUtil.toString(key); results.add(keyString); } }); } return results; }
/** {@inheritDoc} */ @Override public Set<O> getValuesForKeysContainedIn(CharSequence document) { Iterable<CharSequence> documentSuffixes = CharSequenceUtil.generateSuffixes(document); final Set<O> results = new LinkedHashSet<O>(); for (CharSequence documentSuffix : documentSuffixes) { radixTree.scanForKeysAtStartOfInput( documentSuffix, new ConcurrentInvertedRadixTreeImpl.KeyValueHandler() { @Override public void handle(CharSequence key, Object value) { @SuppressWarnings({"unchecked"}) O valueTyped = (O) value; results.add(valueTyped); } }); } return results; }