Effective Java - Item 10 Always override toString

Item 10: Always override toString java.lang.Object provides an implementation of the toString method, but it returns is generally not what the user of your class wants to see. the returns will be followed by an ( @ ) and the...

Cheat Sheet

NPM mirror repository npm –key value npm –registry https://registry.npm.taobao.org info underscore config npm config set registry https://registry.npm.taobao.org npm info underscore The rule of thumb 1.Three ways to check empty 1. if (typeOf(x) == "undefined") 2. if (typeOf(x) != "object") 3....

Effective Java - Item 8 Overriding Equals

Methods Common to All Objects Item 8 ~ 12 Item 8: Obey the general contract when overriding equals we should obey the equals and hashCode contracts (Item 8, Item 9) Overriding the equals method seems simple, but there are many...

Effective Java - Item 7 Avoid finalizers

Avoid finalizers Finalizers are unpredictable, often dangerous, and generally unnecessary. 1.As a rule of thumb, you should avoid finalizers do not to think of finalizers as Java’s analog of C++ destructors. [In C++] destructors are the normal way to reclaim...

Effective Java - Item 6 Eliminate obsolete object references

Eliminate obsolete object references manual memory management Language (C/C++) VS. garbage-collected language (Java) Java will automatically reclaim objects. It seems good that you don’t have to think about memory management. But this isn’t quite true. Memory leaks in garbage-collected languages...