public class UniqueLookupIndex<KEY,ITEM> extends java.lang.Object implements LookupIndex<KEY,ITEM>
Modifier and Type | Field and Description |
---|---|
protected java.util.List<ITEM> |
items |
protected Function<ITEM,KEY> |
keyGetter |
protected java.util.Map<KEY,ITEM> |
map |
Constructor and Description |
---|
UniqueLookupIndex(java.lang.Class<?> keyType) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(ITEM item) |
java.util.List<ITEM> |
all() |
void |
clear() |
boolean |
delete(ITEM item) |
boolean |
deleteByKey(KEY key) |
ITEM |
get(KEY key) |
java.util.List<ITEM> |
getAll(KEY key) |
protected KEY |
getKey(KEY key) |
void |
init() |
boolean |
isPrimaryKeyOnly() |
void |
setBucketSize(int size) |
void |
setInputKeyTransformer(Function<java.lang.Object,KEY> func) |
void |
setKeyGetter(Function<ITEM,KEY> keyGetter) |
int |
size() |
java.util.Collection<ITEM> |
toCollection() |
protected java.util.List<ITEM> items
public void setKeyGetter(Function<ITEM,KEY> keyGetter)
setKeyGetter
in interface LookupIndex<KEY,ITEM>
public java.util.List<ITEM> getAll(KEY key)
getAll
in interface LookupIndex<KEY,ITEM>
public java.util.Collection<ITEM> toCollection()
toCollection
in interface Bag<ITEM>
public boolean deleteByKey(KEY key)
deleteByKey
in interface LookupIndex<KEY,ITEM>
public boolean isPrimaryKeyOnly()
isPrimaryKeyOnly
in interface LookupIndex<KEY,ITEM>
public void init()
init
in interface LookupIndex<KEY,ITEM>
public void setInputKeyTransformer(Function<java.lang.Object,KEY> func)
setInputKeyTransformer
in interface LookupIndex<KEY,ITEM>
public void setBucketSize(int size)
setBucketSize
in interface LookupIndex<KEY,ITEM>