Groovy Goodness: Unmodifiable Collections

When we wanted to create collections in Groovy that were unmodifiable we could use asImmutable. Since Groovy 2.5.0 we can also use the asUnmodifiable method on collections. The method can be applied on all Collection types including Map.

In the following example we use asUnmodifiable on a List and Map:

Written with Groovy 2.5.0.

Original post

This entry was posted in Coding, Groovy and tagged by mrhaki. Bookmark the permalink.

About mrhaki

My name is Hubert A. Klein Ikkink also known as mrhaki. I work at the great IT company JDriven. Here I work on projects with Groovy & Grails, Gradle and Spring. At JDriven we focus on SpringSource technologies. All colleagues want to learn new technologies, support craftmanship and are very eager to learn. This is truly a great environment to work in. You can contact me via Google+ or @mrhaki.

Leave a Reply

Your email address will not be published. Required fields are marked *