[jbosscache-dev] New collections

Brian Stansberry brian.stansberry at redhat.com
Wed Jul 23 12:20:08 EDT 2008


Should these migrate to jboss-common so they can come from there in 
future releases? Or if not come from there for JBC use, be available to 
projects outside JBC?

Manik Surtani wrote:
> Guys,
> 
> I have created 3 new collection impls in trunk - ImmutableListCopy, 
> ImmutableSetCopy and ImmutableMapCopy.  I have also ported the first 2 
> to branch 2.2.x (the reason why I didnt port the third is because the 
> MapCopy which it replaces can get serialized and I don't want to break 
> binary compat).
> 
> See the Javadoc of these classes for more details, but in a nutshell 
> these are very efficient alternatives to the "immutable and defensively 
> copied" idiom.  I.e., if you ever find yourself doing:
> 
>     return Collections.unmodifiableList(new ArrayList(internalList))
> 
> you should consider ImmutableListCopy instead.  Constructon time is 
> about a tenth of the combined time it takes to create an ArrayList and 
> then wrap it in an UnmodifiableList.  Also, iteration is very quick 
> since the internal array is immutable.  Please keep this in mind when 
> working on JBC code.
> 
> Cheers,
> -- 
> Manik Surtani
> Lead, JBoss Cache
> manik at jboss.org
> 
> 
> 
> 
> _______________________________________________
> jbosscache-dev mailing list
> jbosscache-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jbosscache-dev


-- 
Brian Stansberry
Lead, AS Clustering
JBoss, a division of Red Hat
brian.stansberry at redhat.com



More information about the jbosscache-dev mailing list