mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-08-09 16:25:41 +00:00
perf[protocol]: 统一反序列化为空和不为空的语义,都返回一个可以操作的集合而不是不能操作的集合
This commit is contained in:
@@ -76,15 +76,15 @@ public abstract class CollectionUtils {
|
||||
|
||||
|
||||
public static List<?> newList(int size) {
|
||||
return size <= 0 ? Collections.EMPTY_LIST : new ArrayList<>(comfortableLength(size));
|
||||
return size <= 0 ? new ArrayList<>() : new ArrayList<>(comfortableLength(size));
|
||||
}
|
||||
|
||||
public static Set<?> newSet(int size) {
|
||||
return size <= 0 ? Collections.EMPTY_SET : new HashSet<>(comfortableCapacity(size));
|
||||
return size <= 0 ? new HashSet<>() : new HashSet<>(comfortableCapacity(size));
|
||||
}
|
||||
|
||||
public static Map<?, ?> newMap(int size) {
|
||||
return size <= 0 ? Collections.EMPTY_MAP : new HashMap<>(comfortableCapacity(size));
|
||||
return size <= 0 ? new HashMap<>() : new HashMap<>(comfortableCapacity(size));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user