mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-05-26 14:00:34 +00:00
perf[storage]: remove the useless cast type
This commit is contained in:
@@ -35,11 +35,10 @@ public class StorageInt<K, V> extends AbstractStorage<K, V> {
|
||||
|
||||
this.dataMap = new IntObjectHashMap<>(values.size());
|
||||
for (var value : values) {
|
||||
@SuppressWarnings("unchecked")
|
||||
var id = (K) ReflectionUtils.getField(idDef.getField(), value);
|
||||
var id = (Integer) ReflectionUtils.getField(idDef.getField(), value);
|
||||
@SuppressWarnings("unchecked")
|
||||
var v = (V) value;
|
||||
dataMap.put((Integer) id, v);
|
||||
dataMap.put(id, v);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,11 +35,10 @@ public class StorageLong<K, V> extends AbstractStorage<K, V> {
|
||||
|
||||
this.dataMap = new LongObjectHashMap<>(values.size());
|
||||
for (var value : values) {
|
||||
@SuppressWarnings("unchecked")
|
||||
var id = (K) ReflectionUtils.getField(idDef.getField(), value);
|
||||
var id = (Long) ReflectionUtils.getField(idDef.getField(), value);
|
||||
@SuppressWarnings("unchecked")
|
||||
var v = (V) value;
|
||||
dataMap.put((Long) id, v);
|
||||
dataMap.put(id, v);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ public class StorageObject<K, V> extends AbstractStorage<K, V> {
|
||||
var id = (K) ReflectionUtils.getField(idDef.getField(), value);
|
||||
@SuppressWarnings("unchecked")
|
||||
var v = (V) value;
|
||||
dataMap.put((K) id, v);
|
||||
dataMap.put(id, v);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user