Interface IndexedModel<T>
- Type Parameters:
T- the object that this model contains.
- All Known Implementing Classes:
ListModel
public interface IndexedModel<T>
A data model for use with objects that contain lists of predefined objects stored in a list.
- Author:
- Matthew Tropiano
-
Method Summary
Modifier and TypeMethodDescriptionintgetIndexByValue(T value) Returns a specific index number of a value in this model.getValueByIndex(int index) Returns the value at a specific index number in this model.default booleanisEmpty()intsize()
-
Method Details
-
getValueByIndex
Returns the value at a specific index number in this model. If this index number is invalid, this returns null.- Parameters:
index- the desired index.- Returns:
- the corresponding value, or null if not found.
-
getIndexByValue
Returns a specific index number of a value in this model. If the value is not in this model, this returns -1.- Parameters:
value- the desired value.- Returns:
- the corresponding index, or -1 if not found.
-
size
int size()- Returns:
- the amount of values in this model.
-
isEmpty
default boolean isEmpty()- Returns:
- true if this contains no values, false otherwise.
-