public class ArrayWordList extends AbstractWordList
WordList backed by a string array. Since the entire word list is stored in memory java heap
settings may need to be modified in order to store large word lists.| Modifier and Type | Field and Description |
|---|---|
protected String[] |
words
file containing words.
|
comparator| Constructor and Description |
|---|
ArrayWordList(String[] array)
Creates a new case-sensitive word list backed by the given array.
|
ArrayWordList(String[] array,
boolean caseSensitive)
Creates a new word list backed by the given array.
|
ArrayWordList(String[] array,
boolean caseSensitive,
ArraySorter sorter)
Creates a new word list backed by the given array with optional sorting of the input string array.
|
| Modifier and Type | Method and Description |
|---|---|
String |
get(int index)
Returns the word at the given 0-based index.
|
int |
size()
Returns the number of words in the list.
|
String |
toString() |
checkIsString, checkRange, getComparator, iterator, medianIteratorprotected String[] words
public ArrayWordList(String[] array)
array - Array of words.IllegalArgumentException - If array is null or contains any null entries.public ArrayWordList(String[] array, boolean caseSensitive)
array - Array of words.caseSensitive - Set to true to create case-sensitive word list, false otherwise.IllegalArgumentException - If array is null or contains any null entries.public ArrayWordList(String[] array, boolean caseSensitive, ArraySorter sorter)
array - Array of words.caseSensitive - Set to true to create case-sensitive word list, false otherwise.sorter - To sort the input array with. The sort routine is consistent with AbstractWordList.getComparator(), which
respects the case sensitivity of the word list.IllegalArgumentException - If array is null or contains any null entries.public String get(int index)
WordListindex - 0-based index.public int size()
WordListCopyright © 2003-2024 Virginia Tech. All Rights Reserved.