You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "BELUGA BEHR (JIRA)" <ji...@apache.org> on 2018/12/28 22:58:00 UTC
[jira] [Created] (THRIFT-4695) Pre-Size Java Collections in Union
BELUGA BEHR created THRIFT-4695:
-----------------------------------
Summary: Pre-Size Java Collections in Union
Key: THRIFT-4695
URL: https://issues.apache.org/jira/browse/THRIFT-4695
Project: Thrift
Issue Type: Improvement
Components: Java - Library
Affects Versions: 0.12.0
Reporter: BELUGA BEHR
One of these methods is not like the other (collections are pre-sized).
{code:java|title=TUnion.java}
private static Map deepCopyMap(Map<Object, Object> map) {
Map copy = new HashMap();
for (Map.Entry<Object, Object> entry : map.entrySet()) {
copy.put(deepCopyObject(entry.getKey()), deepCopyObject(entry.getValue()));
}
return copy;
}
private static Set deepCopySet(Set set) {
Set copy = new HashSet();
for (Object o : set) {
copy.add(deepCopyObject(o));
}
return copy;
}
private static List deepCopyList(List list) {
List copy = new ArrayList(list.size());
for (Object o : list) {
copy.add(deepCopyObject(o));
}
return copy;
}
{code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)