Package org.passay.dictionary
Class ArrayWordList
java.lang.Object
org.passay.dictionary.AbstractWordList
org.passay.dictionary.ArrayWordList
- All Implemented Interfaces:
WordList
Provides a
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.-
Field Summary
FieldsFields inherited from class org.passay.dictionary.AbstractWordList
comparator -
Constructor Summary
ConstructorsConstructorDescriptionArrayWordList(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. -
Method Summary
Methods inherited from class org.passay.dictionary.AbstractWordList
checkRange, getComparator, iterator, medianIterator
-
Field Details
-
words
file containing words.
-
-
Constructor Details
-
ArrayWordList
Creates a new case-sensitive word list backed by the given array.- Parameters:
array- Array of words.- Throws:
IllegalArgumentException- If array is null or contains any null entries.
-
ArrayWordList
Creates a new word list backed by the given array.- Parameters:
array- Array of words.caseSensitive- Set to true to create case-sensitive word list, false otherwise.- Throws:
IllegalArgumentException- If array is null or contains any null entries.
-
ArrayWordList
Creates a new word list backed by the given array with optional sorting of the input string array.- Parameters:
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 withAbstractWordList.getComparator(), which respects the case sensitivity of the word list.- Throws:
IllegalArgumentException- If array is null or contains any null entries.
-
-
Method Details
-
get
Description copied from interface:WordListReturns the word at the given 0-based index.- Parameters:
index- 0-based index.- Returns:
- word at given index.
-
size
public int size()Description copied from interface:WordListReturns the number of words in the list.- Returns:
- total number of words in list.
-
toString
-