Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Giovanni Azua Newsgroups: comp.lang.java.programmer Subject: Re: Immutable Datastructures with good Sharing Date: Sun, 06 Nov 2011 16:18:41 +0100 Lines: 34 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Trace: individual.net LkDXVPl6mrCG83zvOidcwwLZsfSam7+MAoFoIf9C2PuGX75jnF Cancel-Lock: sha1:BaQHzpRLYIvsxi1ekfiLoRg4LiM= User-Agent: Microsoft-Entourage/12.31.0.110725 Thread-Topic: Immutable Datastructures with good Sharing Thread-Index: Acycl12GUhe5f71q40mrWzXjsLQm6A== In-Reply-To: Posted-And-Mailed: yes Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:9658 Hello, I haven't read/followed the whole OP Thread discussion but I thought it was worth mentioning/recommending the Google "Guava Project": http://code.google.com/p/guava-libraries/ I think they really "went to town" on that one. You have strongly typed Immutable Collection definitions for all Java Collection types e.g. ImmutableMap.Builder, ImmutableList.Builder. The design is awesome e.g. the Builder pattern as prescribed in Effective Java (last edition) and the performance gains are noticeable as well e.g. In a distributed system I have been working on lately, switching the attribute instances of the DTO Beans from ArrayList Java Collection to use instead the implementation from Guava gave some noticeable 15-20% Serialization performance gain e.g. Test case involving 1-Echo-Server and 1K-Clients. I really enjoy the improvement in code readability as well, it suits the appropriate template types e.g. // from List requests = new ArrayList(); // to List requests = Lists.newArrayList(); Guava really rocks! Would this be the Java Collections design debt now finally paid by Joshua Bloch? HTH, Best regards, Giovanni