Total Pageviews

Monday, February 06, 2012

Deep cloning of java objects

I was in need of deep cloning a map with all its keys and values.
All the map implementations in standard Java only do shallow cloning of the map. They don't clone the keys and values. But that was exactly what I want to realize.
I found out about the cloning library which does the job very easy and extremely fast. This library can clone nearly any java object.
A cloning expression is just a two-liner.
Very useful!
On this stackoverflow question you can find more deep cloning libraries.