thrift-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James E. King III (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (THRIFT-4695) Pre-Size Java Collections in Union
Date Mon, 31 Dec 2018 03:40:00 GMT

     [ 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)

Mime
View raw message