Amazon

Monday, February 27, 2012

Core Java - Key Performance Optimization

  1. Create Objects locally (method level) as much as possible. Keeping objects at Object Level or Class Level blocks the memory for the life time of Object or till class gets unloaded.
  2. List should be browsed using size() and index in for loop or other loops, rather than using Iterator to iterate the List. Using index is faster than using Iterator.
  3. When large size of text are used in program, always prefer StringBuffer than String. StringBuffer objects will get deleted once the program ends, but String objects don't get deleted from the JVM. Read Perm-Generation for more details.
  4. Never say hashMap.containsKey("key") to see the item is present in map or not and after that retrieve it using hashMap.get("key"). containsKey() and get() use same methods internally to find elements in a map. Better do hashMap.get("key") and do null check on the value retrieved from the hashMap using key.

Amazon Best Sellors

TOGAF 9.2 - STUDY [ The Open Group Architecture Framework ] - Chap 01 - Introduction

100 Feet View of TOGAF  What is Enterprise? Collection of Organization that has common set of Goals. Enterprise has People - organized by co...