Joshua Bloch

Effective Java, Third Edition

Notify me when the book’s added
To read this book, upload an EPUB or FB2 file to Bookmate. How do I upload a book?
  • diormuhas quoted2 months ago
    Default methods are, however, extremely useful for providing standard method implementations when an interface is created, to ease the task of implementing the interface (Item 20).
  • diormuhas quoted4 months ago
    eliminate the class’s self-use of overridable methods entirely. In doing so, you’ll create a class that is reasonably safe to subclass. Overriding a method will never affect the behavior of any other method.
  • diormuhas quoted8 months ago
    The toString method should return a concise, useful description of the object
  • diormuhas quoted9 months ago
    providing a good toString implementation makes your class much more pleasant to use and makes systems using the class easier to debug.
  • diormuhas quoted9 months ago
    when is it appropriate to override equals? It is when a class has a notion of logical equality that differs from mere object identity and a superclass has not already overridden equals.
  • diormuhas quoted10 months ago
    The Boolean.valueOf(boolean) method illustrates this technique: it never creates an object. This technique is similar to the Flyweight pattern [Gamma95]. It can greatly improve performance if equivalent objects are requested often, especially if they are expensive to create.
  • diormuhas quoted2 years ago
    Note that a nonzero-length array is always mutable, so it is wrong for a class to have a public static final array field, or an accessor that returns such a field.
  • diormuhas quoted2 years ago
    a method overrides a superclass method, it cannot have a more restrictive access level in the subclass than in the superclass
  • diormuhas quoted2 years ago
    The rule of thumb is simple: make each class or member as inaccessible as possible.
  • diormuhas quoted2 years ago
    Use of the relational operators < and > in compareTo methods is verbose and error-prone and no longer recommended.
fb2epub
Drag & drop your files (not more than 5 at once)