T
- type of objects in this indexV
- type of the field used for indexingpublic interface FieldIndex<T,V> extends Iterable<T>
IndexedSet
, each index for this set must
implement the interface to define how to get the value of the field chosen as the index. Users
must use the same instance of the implementation of this interface as the parameter in all
methods of IndexedSet
to represent the same index.Modifier and Type | Method and Description |
---|---|
boolean |
add(T o)
Adds an object o to the index.
|
void |
clear()
Removes all the entries in this index.
|
boolean |
containsField(V fieldValue)
Returns whether there is an object with the specified index field value in the set.
|
boolean |
containsObject(T o)
Returns whether there is an object in the set.
|
Set<T> |
getByField(V value)
Gets a subset of objects with the specified field value.
|
T |
getFirst(V value)
Gets an object from the set of objects with the specified field value.
|
Iterator<T> |
iterator()
Returns an iterator over the elements in this index.
|
boolean |
remove(T o)
Removes the object o from the index.
|
int |
size() |
forEach, spliterator
boolean add(T o)
o
- the object to add to the indexboolean remove(T o)
o
- the object to remove from indexvoid clear()
boolean containsField(V fieldValue)
fieldValue
- the field value to be satisfiedboolean containsObject(T o)
o
- the object to be checkedSet<T> getByField(V value)
value
- the field value to be satisfiedT getFirst(V value)
value
- the field value to be satisfiedIterator<T> iterator()
iterator
in interface Iterable<T>
FieldIndex
int size()
Copyright © 2023. All Rights Reserved.