Package autocomplete
Class BinarySearchAutocomplete
- java.lang.Object
-
- autocomplete.BinarySearchAutocomplete
-
- All Implemented Interfaces:
Autocomplete
public class BinarySearchAutocomplete extends Object implements Autocomplete
Binary search implementation of theAutocompleteinterface.- See Also:
Autocomplete
-
-
Field Summary
Fields Modifier and Type Field Description private List<CharSequence>termsListof added autocompletion terms.
-
Constructor Summary
Constructors Constructor Description BinarySearchAutocomplete()Constructs an empty instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAll(Collection<? extends CharSequence> terms)Adds the given collection of autocompletion terms.List<CharSequence>allMatches(CharSequence prefix)Returns all autocompletion terms that match the given prefix.
-
-
-
Field Detail
-
terms
private final List<CharSequence> terms
Listof added autocompletion terms.
-
-
Method Detail
-
addAll
public void addAll(Collection<? extends CharSequence> terms)
Description copied from interface:AutocompleteAdds the given collection of autocompletion terms.- Specified by:
addAllin interfaceAutocomplete- Parameters:
terms- collection containing elements to be added.
-
allMatches
public List<CharSequence> allMatches(CharSequence prefix)
Description copied from interface:AutocompleteReturns all autocompletion terms that match the given prefix.- Specified by:
allMatchesin interfaceAutocomplete- Parameters:
prefix- search query.
-
-