mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-10-15 14:16:45 +00:00
feat[serialization]: use primitive type hash map to deserialize
This commit is contained in:
1 parent
89f3c85d41
commit
5f6263e380
1 file changed
+8
-8
@@ -451,9 +451,9 @@ public abstract class ByteBufUtils {
|
|||||||
|
|
||||||
public static Map<Integer, Integer> readIntIntMap(ByteBuf byteBuf) {
|
public static Map<Integer, Integer> readIntIntMap(ByteBuf byteBuf) {
|
||||||
var length = readInt(byteBuf);
|
var length = readInt(byteBuf);
|
||||||
var map = new IntObjectHashMap<Integer>(CollectionUtils.comfortableCapacity(length));
|
var map = new HashMapIntInt(CollectionUtils.comfortableCapacity(length));
|
||||||
for (var i = 0; i < length; i++) {
|
for (var i = 0; i < length; i++) {
|
||||||
map.put(readInt(byteBuf), readIntBox(byteBuf));
|
map.putPrimitive(readInt(byteBuf), readInt(byteBuf));
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
@@ -472,9 +472,9 @@ public abstract class ByteBufUtils {
|
|||||||
|
|
||||||
public static Map<Integer, Long> readIntLongMap(ByteBuf byteBuf) {
|
public static Map<Integer, Long> readIntLongMap(ByteBuf byteBuf) {
|
||||||
var length = readInt(byteBuf);
|
var length = readInt(byteBuf);
|
||||||
var map = new IntObjectHashMap<Long>(CollectionUtils.comfortableCapacity(length));
|
var map = new HashMapIntLong(CollectionUtils.comfortableCapacity(length));
|
||||||
for (var i = 0; i < length; i++) {
|
for (var i = 0; i < length; i++) {
|
||||||
map.put(readInt(byteBuf), readLongBox(byteBuf));
|
map.putPrimitive(readInt(byteBuf), readLong(byteBuf));
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
@@ -535,9 +535,9 @@ public abstract class ByteBufUtils {
|
|||||||
|
|
||||||
public static Map<Long, Integer> readLongIntMap(ByteBuf byteBuf) {
|
public static Map<Long, Integer> readLongIntMap(ByteBuf byteBuf) {
|
||||||
var length = readInt(byteBuf);
|
var length = readInt(byteBuf);
|
||||||
var map = new LongObjectHashMap<Integer>(CollectionUtils.comfortableCapacity(length));
|
var map = new HashMapLongInt(CollectionUtils.comfortableCapacity(length));
|
||||||
for (var i = 0; i < length; i++) {
|
for (var i = 0; i < length; i++) {
|
||||||
map.put(readLong(byteBuf), readIntBox(byteBuf));
|
map.putPrimitive(readLong(byteBuf), readInt(byteBuf));
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
@@ -556,9 +556,9 @@ public abstract class ByteBufUtils {
|
|||||||
|
|
||||||
public static Map<Long, Long> readLongLongMap(ByteBuf byteBuf) {
|
public static Map<Long, Long> readLongLongMap(ByteBuf byteBuf) {
|
||||||
var length = readInt(byteBuf);
|
var length = readInt(byteBuf);
|
||||||
var map = new LongObjectHashMap<Long>(CollectionUtils.comfortableCapacity(length));
|
var map = new HashMapLongLong(CollectionUtils.comfortableCapacity(length));
|
||||||
for (var i = 0; i < length; i++) {
|
for (var i = 0; i < length; i++) {
|
||||||
map.put(readLong(byteBuf), readLongBox(byteBuf));
|
map.putPrimitive(readLong(byteBuf), readLong(byteBuf));
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user