mirror of
https://github.com/valitydev/thrift.git
synced 2024-11-07 10:48:51 +00:00
THRIFT-4695: Pre-Size Java Collections in Union
This commit is contained in:
parent
75bac10dbd
commit
bf51a9faf9
@ -79,7 +79,7 @@ public abstract class TUnion<T extends TUnion<T,F>, F extends TFieldIdEnum> impl
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static Map deepCopyMap(Map<Object, Object> map) {
|
private static Map deepCopyMap(Map<Object, Object> map) {
|
||||||
Map copy = new HashMap();
|
Map copy = new HashMap(map.size());
|
||||||
for (Map.Entry<Object, Object> entry : map.entrySet()) {
|
for (Map.Entry<Object, Object> entry : map.entrySet()) {
|
||||||
copy.put(deepCopyObject(entry.getKey()), deepCopyObject(entry.getValue()));
|
copy.put(deepCopyObject(entry.getKey()), deepCopyObject(entry.getValue()));
|
||||||
}
|
}
|
||||||
@ -87,7 +87,7 @@ public abstract class TUnion<T extends TUnion<T,F>, F extends TFieldIdEnum> impl
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static Set deepCopySet(Set set) {
|
private static Set deepCopySet(Set set) {
|
||||||
Set copy = new HashSet();
|
Set copy = new HashSet(set.size());
|
||||||
for (Object o : set) {
|
for (Object o : set) {
|
||||||
copy.add(deepCopyObject(o));
|
copy.add(deepCopyObject(o));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user