T
- type of objects in this indexV
- type of the field used for indexing@ThreadSafe public class NonUniqueFieldIndex<T,V> extends Object implements FieldIndex<T,V>
Constructor and Description |
---|
NonUniqueFieldIndex(IndexDefinition<T,V> indexDefinition)
Constructs a new
NonUniqueFieldIndex instance. |
Modifier and Type | Method and Description |
---|---|
boolean |
add(T object)
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 object)
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 object)
Removes the object o from the index.
|
int |
size() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public NonUniqueFieldIndex(IndexDefinition<T,V> indexDefinition)
NonUniqueFieldIndex
instance.indexDefinition
- definition of indexpublic boolean add(T object)
FieldIndex
add
in interface FieldIndex<T,V>
object
- the object to add to the indexpublic boolean remove(T object)
FieldIndex
remove
in interface FieldIndex<T,V>
object
- the object to remove from indexpublic void clear()
FieldIndex
clear
in interface FieldIndex<T,V>
public boolean containsField(V fieldValue)
FieldIndex
containsField
in interface FieldIndex<T,V>
fieldValue
- the field value to be satisfiedpublic boolean containsObject(T object)
FieldIndex
containsObject
in interface FieldIndex<T,V>
object
- the object to be checkedpublic Set<T> getByField(V value)
FieldIndex
getByField
in interface FieldIndex<T,V>
value
- the field value to be satisfiedpublic T getFirst(V value)
FieldIndex
getFirst
in interface FieldIndex<T,V>
value
- the field value to be satisfiedpublic Iterator<T> iterator()
FieldIndex
iterator
in interface FieldIndex<T,V>
iterator
in interface Iterable<T>
FieldIndex
public int size()
size
in interface FieldIndex<T,V>
Copyright © 2023. All Rights Reserved.