From dev-return-54366-archive-asf-public=cust-asf.ponee.io@thrift.apache.org Mon Dec 31 04:49:13 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 745F818062A for ; Mon, 31 Dec 2018 04:49:13 +0100 (CET) Received: (qmail 94213 invoked by uid 500); 31 Dec 2018 03:49:12 -0000 Mailing-List: contact dev-help@thrift.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@thrift.apache.org Delivered-To: mailing list dev@thrift.apache.org Received: (qmail 94200 invoked by uid 99); 31 Dec 2018 03:49:12 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 31 Dec 2018 03:49:12 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id AFFB9C2587 for ; Mon, 31 Dec 2018 03:49:11 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -110.301 X-Spam-Level: X-Spam-Status: No, score=-110.301 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id LUEsVL73ujZo for ; Mon, 31 Dec 2018 03:49:10 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id BF9EB5F588 for ; Mon, 31 Dec 2018 03:40:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id DAA84E2618 for ; Mon, 31 Dec 2018 03:40:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 37FE42538C for ; Mon, 31 Dec 2018 03:40:00 +0000 (UTC) Date: Mon, 31 Dec 2018 03:40:00 +0000 (UTC) From: "James E. King III (JIRA)" To: dev@thrift.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Resolved] (THRIFT-4695) Pre-Size Java Collections in Union MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ 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 map) { > Map copy = new HashMap(); > for (Map.Entry 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)