Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!.POSTED!not-for-mail From: Jan Burse Newsgroups: comp.lang.java.programmer Subject: Re: Immutable Datastructures with good Sharing Date: Mon, 07 Nov 2011 05:13:27 +0100 Organization: albasani.net Lines: 46 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.albasani.net Z/enJ87Vcuaz51/xagHnHA/e5fsuZe17/KrovuN96GOTyNorSF4JibOMtctFs02UZadwwLJq7iErP9E3tza/tA== NNTP-Posting-Date: Mon, 7 Nov 2011 04:13:28 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="1DNyGz5XfmVfzX0cvvrKvDpwmhZRSOMrWDWKGqh1+gwRigGIMtuxtVyoDByyXoJ/AkSyL8ruu7t2DOKpNmZ2474+HqhZgeWtozsHv8pUpdb7fBI4g/I7vQEatR0MEUdG"; mail-complaints-to="abuse@albasani.net" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:7.0.1) Gecko/20110928 Firefox/7.0.1 SeaMonkey/2.4.1 In-Reply-To: Cancel-Lock: sha1:ttaz1RxCvflrO6AlXlsWpfBKztI= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:9726 Jan Burse schrieb: > I guess the putAll() results in cloning, therefore > no good sharing, therefore not a solution to the > problem at hand. > > But I might be wrong. > > Yep it is of no use. First we have behind newArrayList the following: public static ArrayList newArrayList() { return new ArrayList(); } http://code.google.com/p/google-collections/source/browse/trunk/src/com/google/common/collect/Lists.java Then we have behind put and putAll(): public static class Builder { final List> entries = Lists.newArrayList(); public Builder put(K key, V value) { entries.add(entryOf(key, value)); return this; } public Builder putAll(Map map) { for (Entry entry : map.entrySet()) { put(entry.getKey(), entry.getValue()); } return this; } http://www.docjar.com/html/api/com/google/inject/internal/ImmutableMap.java.html So the whole thing, in version 1.0, doesn't make much sense, except that it has the label Google on it. Bye