Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Java
Expertise: Beginner
Oct 18, 2017

WEBINAR: On-Demand

Unleash Your DevOps Strategy by Synchronizing Application and Database Changes REGISTER >

Taking Advantage of Immutable Objects in Java

zero = new Integer(0);
return Boolean.valueOf("true");

Integer and Boolean are immutable; so, it is a bad idea to create objects that represent the same value, those classes have built-in caches for frequently used instances. So, the programmer can take advantage of this:

zero = Integer.valueOf(0);
return Boolean.TRUE; 
Octavia Anghel
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date