public final class WordSet extends Object
Performance of the set is comparable to that of TreeSet
for Strings, ie. 2-3x slower than HashSet
when
using pre-constructed Strings. This is generally result of algorithmic
complexity of structures; Word and Tree sets are roughly logarithmic
to the whole data, whereas Hash set is linear to the length of key.
However:
Although this is an efficient set for specific set of usage patterns, one restriction is that the full set of words to include has to be known before constructing the set. Also, the size of the set is limited to total word content of about 20k characters; factory method does verify the limit and indicates if an instance can not be created.
Modifier and Type | Method and Description |
---|---|
static char[] |
constructRaw(TreeSet<String> wordSet) |
static WordSet |
constructSet(TreeSet<String> wordSet) |
static boolean |
contains(char[] data,
char[] str,
int start,
int end) |
boolean |
contains(char[] buf,
int start,
int end) |
static boolean |
contains(char[] data,
String str) |
boolean |
contains(String str) |
Copyright © 2018 FasterXML. All rights reserved.