I’m a big lover of Reflection in Java. It’s extremely powerful and lets you do things that technically shouldn’t be allowed. For example, an Object with a private method cannot be invoked outside of that method by virtue of the “private” keyword. However, if you use reflection: public class MyObject {private void doSomethingHidden() {System.out.println(“I’m hidden…
Month: May 2008
Fastest Deep Cloning
I recently needed to do deep cloning of my Java objects and began to do the old-school style I’ve used for years: Use ObjectOutputStream and ObjectInputStream to do a “poor-boys” deep clone. However, the performance of this on large Objects is absolutely awful not to mention the amount of memory and CPU it takes to…