mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-09-03 08:19:37 +00:00
perf[storage]: Optimize storage generic interfaces
This commit is contained in:
@@ -32,7 +32,6 @@ import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author godotg
|
||||
@@ -172,12 +171,12 @@ public class StorageObject<K, V> implements IStorage<K, V> {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public <INDEX, V> V getUniqueIndex(Func1<V, ?> func, INDEX key) {
|
||||
public <UINDEX> V getUniqueIndex(Func1<V, ?> func, UINDEX key) {
|
||||
String uniqueIndexName = LambdaUtils.getFieldName(func);
|
||||
var indexValueMap = uniqueIndexMap.get(uniqueIndexName);
|
||||
AssertionUtils.notNull(indexValueMap, "There is no a unique index for [uniqueIndexName:{}] in the static resource [resource:{}]", uniqueIndexName, clazz.getSimpleName());
|
||||
var value = indexValueMap.get(key);
|
||||
return (V) value;
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -53,7 +53,7 @@ public interface IStorage<K, V> {
|
||||
<INDEX> List<V> getIndexes(Func1<V, ?> function, INDEX key);
|
||||
|
||||
@Nullable
|
||||
<INDEX, V> V getUniqueIndex(Func1<V, ?> function, INDEX key);
|
||||
<UINDEX> V getUniqueIndex(Func1<V, ?> function, UINDEX key);
|
||||
|
||||
int size();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user