You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "James E. King III (JIRA)" <ji...@apache.org> on 2018/12/31 03:40:00 UTC

[jira] [Resolved] (THRIFT-4695) Pre-Size Java Collections in Union

     [ https://issues.apache.org/jira/browse/THRIFT-4695?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

James E. King III resolved THRIFT-4695.
---------------------------------------
       Resolution: Fixed
         Assignee: James E. King III
    Fix Version/s: 1.0

> 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
>            Assignee: James E. King III
>            Priority: Minor
>             Fix For: 1.0
>
>         Attachments: THRIFT-4695.1.patch
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> 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)