This is an automated email from the ASF dual-hosted git repository.
jking pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/thrift.git
The following commit(s) were added to refs/heads/master by this push:
new bf51a9f THRIFT-4695: Pre-Size Java Collections in Union
bf51a9f is described below
commit bf51a9faf9942571cf1eea64ae260a9ced5c4598
Author: Beluga Behr <[email protected]>
AuthorDate: Sun Dec 30 20:34:13 2018 -0500
THRIFT-4695: Pre-Size Java Collections in Union
---
lib/java/src/org/apache/thrift/TUnion.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/java/src/org/apache/thrift/TUnion.java
b/lib/java/src/org/apache/thrift/TUnion.java
index 13f9c67..1ef11df 100644
--- a/lib/java/src/org/apache/thrift/TUnion.java
+++ b/lib/java/src/org/apache/thrift/TUnion.java
@@ -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) {
- Map copy = new HashMap();
+ Map copy = new HashMap(map.size());
for (Map.Entry<Object, Object> entry : map.entrySet()) {
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) {
- Set copy = new HashSet();
+ Set copy = new HashSet(set.size());
for (Object o : set) {
copy.add(deepCopyObject(o));
}