Expensive creation of a Java instance

Execute this code in your Java program:

SimpleDateFormat df = new SimpleDateFormat();

Here are the consequences:

  • 55 distinct methods are called a total of 123 times
  • 44 new instances of objects are created

That is one badly-designed class. And that's before considering the non-thread-safety of SimpleDateFormat that leads it to be probably the #1 cause of concurrency issues in Java programs. And which prevents reusing one instance across an entire application.

I sourced this here.



Popular posts from this blog

Accessing Library Folder in Mac OS X 10.7 (Lion)

WordPress comments can never be really disabled

T-10: But Retina is Different...