|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
O - The type of the values associated with keys in the treepublic interface RadixTree<O>
API of a radix tree, that is a tree which allows values to be looked up based on prefixes of the keys with which they were associated, as well as based on exact matches for keys. A radix tree essentially allows "equals" and "starts with" lookup.
See documentation on each method for details.
| Method Summary | |
|---|---|
Iterable<CharSequence> |
getClosestKeys(CharSequence candidate)
Returns a lazy iterable which returns the set of keys in the tree which are the closest match for the given candidate key. |
Iterable<CharSequence> |
getKeysStartingWith(CharSequence prefix)
Returns a lazy iterable which returns the set of keys in the tree which start with the given prefix. |
Iterable<KeyValuePair<O>> |
getKeyValuePairsForClosestKeys(CharSequence candidate)
Returns a lazy iterable which returns the set of KeyValuePairs for keys and their associated values in
the tree which are the closest match for the given candidate key. |
Iterable<KeyValuePair<O>> |
getKeyValuePairsForKeysStartingWith(CharSequence prefix)
Returns a lazy iterable which returns the set of KeyValuePairs for keys and their associated values
in the tree, where the keys start with the given prefix. |
O |
getValueForExactKey(CharSequence key)
Returns the value associated with the given key (exact match), or returns null if no such value is associated with the key. |
Iterable<O> |
getValuesForClosestKeys(CharSequence candidate)
Returns a lazy iterable which returns the set of values associated with keys in the tree which are the closest match for the given candidate key. |
Iterable<O> |
getValuesForKeysStartingWith(CharSequence prefix)
Returns a lazy iterable which returns the set of values associated with keys in the tree which start with the given prefix. |
O |
put(CharSequence key,
O value)
Associates the given value with the given key; replacing any previous value associated with the key. |
O |
putIfAbsent(CharSequence key,
O value)
If a value is not already associated with the given key in the tree, associates the given value with the key; otherwise if an existing value is already associated, returns the existing value and does not overwrite it. |
boolean |
remove(CharSequence key)
Removes the value associated with the given key (exact match). |
int |
size()
Counts the number of keys/values stored in the tree. |
| Method Detail |
|---|
O put(CharSequence key,
O value)
key - The key with which the specified value should be associatedvalue - The value to associate with the key, which cannot be null
O putIfAbsent(CharSequence key,
O value)
key - The key with which the specified value should be associatedvalue - The value to associate with the key, which cannot be null
boolean remove(CharSequence key)
key - The key for which an associated value should be removed
O getValueForExactKey(CharSequence key)
key - The key with which a sought value might be associated
Iterable<CharSequence> getKeysStartingWith(CharSequence prefix)
prefix - A prefix of sought keys in the tree
Iterable<O> getValuesForKeysStartingWith(CharSequence prefix)
#equals(Object)).
prefix - A prefix of keys in the tree for which associated values are sought
Iterable<KeyValuePair<O>> getKeyValuePairsForKeysStartingWith(CharSequence prefix)
KeyValuePairs for keys and their associated values
in the tree, where the keys start with the given prefix.
This is inclusive - if the given prefix is an exact match for a key in the tree, the KeyValuePair
for that key is also returned.
prefix - A prefix of keys in the tree for which associated KeyValuePairs are sought
KeyValuePairs for keys in the tree which start with the given prefix, inclusiveIterable<CharSequence> getClosestKeys(CharSequence candidate)
Ford Focus, Ford Mondeo, BMW M3getClosestKeys("Ford F150") -> returns Ford Focus, Ford Mondeo
candidate - A candidate key
Iterable<O> getValuesForClosestKeys(CharSequence candidate)
candidate - A candidate key
Iterable<KeyValuePair<O>> getKeyValuePairsForClosestKeys(CharSequence candidate)
KeyValuePairs for keys and their associated values in
the tree which are the closest match for the given candidate key.
See {#getClosestKeys} for more details.
candidate - A candidate key
KeyValuePairs for keys and their associated values in the tree which most closely
match the candidate key, inclusiveint size()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||