public class TrieMap<V> extends AbstractMap<CharSequence,V> implements Iterable<Map.Entry<CharSequence,V>>
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| Modifier and Type | Field and Description |
|---|---|
protected TreeMap<Character,TrieMap<V>> |
children
Holds the children
|
protected TrieMap<V> |
parent
maps to parent
|
protected int |
size
number of elements
|
protected V |
value
true if this is a word
|
| Modifier | Constructor and Description |
|---|---|
|
TrieMap()
Constructs a Trie
|
protected |
TrieMap(TrieMap<V> p)
Constructs a Trie
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
int |
containedLength(CharSequence s,
int startPos)
Returns the length of the longest contained subsequence, starting from
start position
|
boolean |
containsKey(Object s) |
PeekIterator<Map.Entry<CharSequence,V>> |
entriesIn(CharSequence text)
Returns all entries found in 'text'
|
Set<Map.Entry<CharSequence,V>> |
entrySet() |
protected TrieMap<V> |
get(CharSequence s,
int start,
boolean create)
Get the subtrie corresponding to the substring of sequence s starting from 'start'.
|
boolean |
isEmpty() |
Iterator<Map.Entry<CharSequence,V>> |
iterator() |
static void |
main(String[] args)
Test method
|
V |
put(CharSequence key,
V value) |
int |
size() |
Iterable<String> |
strings()
Iterable for contained words
|
String |
toString() |
PeekIterator<CharSequence> |
wordsIn(CharSequence text)
Returns all words found in 'text'
|
clone, containsValue, equals, get, hashCode, keySet, putAll, remove, valuesfinalize, getClass, notify, notifyAll, wait, wait, waitforEach, spliteratorcompute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAllprotected V value
protected int size
public V put(CharSequence key, V value)
put in interface Map<CharSequence,V>put in class AbstractMap<CharSequence,V>public void clear()
clear in interface Map<CharSequence,V>clear in class AbstractMap<CharSequence,V>public boolean isEmpty()
isEmpty in interface Map<CharSequence,V>isEmpty in class AbstractMap<CharSequence,V>protected TrieMap<V> get(CharSequence s, int start, boolean create)
public boolean containsKey(Object s)
containsKey in interface Map<CharSequence,V>containsKey in class AbstractMap<CharSequence,V>public Iterator<Map.Entry<CharSequence,V>> iterator()
iterator in interface Iterable<Map.Entry<CharSequence,V>>public String toString()
toString in class AbstractMap<CharSequence,V>public int size()
size in interface Map<CharSequence,V>size in class AbstractMap<CharSequence,V>public int containedLength(CharSequence s, int startPos)
public PeekIterator<CharSequence> wordsIn(CharSequence text)
public PeekIterator<Map.Entry<CharSequence,V>> entriesIn(CharSequence text)
public static void main(String[] args)
public Set<Map.Entry<CharSequence,V>> entrySet()
entrySet in interface Map<CharSequence,V>entrySet in class AbstractMap<CharSequence,V>Copyright © 2018. All rights reserved.