Java Reference
In-Depth Information
< Day Day Up >
15. Other Libraries
This section concern various Java platform libraries.
15.1. Overriding equals without overriding hashCode can cause erratic
behavior
Prescription: When overriding equals , always override hashCode .
References: Puzzle 57 ; [EJ Item 8].
15.2. Calendar and Date are poorly designed
Prescription: Be careful when using Calendar and Date ; always consult the API documentation.
References: Puzzle 61 .
15.3. Many classes are immutable, their method names notwithstanding
Prescription: Do not be misled into thinking that immutable types are mutable. Immutable types
include String , Integer , Long , Short , Byte , Character , Boolean , Float , Double , BigInteger , and
BigDecimal .
References: Puzzle 56 .
15.4. Some deprecated methods are toxic
Prescription: Avoid deprecated methods, such as Thread.stop , Thread.suspend ,
Runtime.runFinalizersOnExit , and System.runFinalizersOnExit .
References: Puzzle 39 and 43 ; [ThreadStop] .
15.5. Using homemade solutions instead of libraries tends to cause
wasted effort, bugs, and poor performance
Prescription: Know and use the libraries.
References: Puzzles 60 , 62 , and 94 ; [EJ Item 30].
< Day Day Up >
 
 
Search WWH ::




Custom Search