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] [Commented] (THRIFT-4695) Pre-Size Java Collections in Union
Date Sat, 29 Dec 2018 19:42:00 GMT

    [ https://issues.apache.org/jira/browse/THRIFT-4695?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16730804#comment-16730804
] 

James E. King III commented on THRIFT-4695:
-------------------------------------------

Please submit patches as pull requests so they get into the workflow.

> 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
>            Priority: Minor
>         Attachments: THRIFT-4695.1.patch
>
>
> 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