Quotes from Effective Java Programming Language Guide

272 pages

Rating: (5.1K votes)


“One advantage of static factory methods is that, unlike constructors, they have names.”
― quote from Effective Java Programming Language Guide


“Learning the art of programming, like most other disciplines, consists of first learning the rules and then learning when to break them.”
― quote from Effective Java Programming Language Guide


“Collection or an appropriate subtype is generally the best return type for a public, sequence- returning method.”
― quote from Effective Java Programming Language Guide


“Writing concurrent programs in Java keeps getting easier, but writing concurrent programs that are correct and fast is as difficult as it ever was.”
― quote from Effective Java Programming Language Guide


“A second advantage of static factory methods is that, unlike constructors, they are not required to create a new object each time they're invoked.”
― quote from Effective Java Programming Language Guide



“If you export a nontrivial interface, you should strongly consider providing a skeletal implementation to go with it. To the extent possible, you should provide the skeletal implementation via default methods on the interface so that all implementors of the interface can make use of it.”
― quote from Effective Java Programming Language Guide


“Implementing a constant interface causes this implementation detail to leak into the class’s exported API. It is of no consequence to the users of a class that the class implements a constant interface. In fact, it may even confuse them. Worse, it represents a commitment: if in a future release the class is modified so that it no longer needs to use the constants, it still must implement the interface to ensure binary compatibility. If a nonfinal class implements a constant interface, all of its subclasses will have their namespaces polluted by the constants in the interface.”
― quote from Effective Java Programming Language Guide


“You can put any element into a collection with a raw type, easily corrupting the collection’s type invariant (as demonstrated by the unsafeAdd method on page 119); you can’t put any ele- ment (other than null) into a Collection<?>.”
― quote from Effective Java Programming Language Guide


“arrays are covariant. This scary-sounding word means simply that if Sub is a subtype of Super, then the array type Sub[] is a subtype of the array type Super[]. Generics, by contrast, are invariant: for any two distinct types Type1 and Type2, List is neither a subtype nor a supertype of List. You might think this means that generics are deficient, but arguably it is arrays that are deficient.”
― quote from Effective Java Programming Language Guide


“A forEach operation that does anything more than present the result of the computation performed by a stream is a “bad smell in code,” as is a lambda that mutates state.”
― quote from Effective Java Programming Language Guide



“streams do not make iteration obsolete”
― quote from Effective Java Programming Language Guide


“premature optimization is the root of all evil. —Donald E. Knuth [”
― quote from Effective Java Programming Language Guide


“In other words, it is about 50 times slower to create and destroy objects with finalizers.”
― quote from Effective Java Programming Language Guide


“In fact, two-thirds of the uses of the close method in the Java libraries were wrong in 2007.”
― quote from Effective Java Programming Language Guide


“There is no way to extend an instantiable class and add a value component while preserving the equals contract, unless you’re willing to forgo the benefits of object-oriented abstraction.”
― quote from Effective Java Programming Language Guide



“Given all the problems associated with Cloneable, new interfaces should not extend it, and new extendable classes should not implement it.”
― quote from Effective Java Programming Language Guide


“It is too early to say whether modules will achieve widespread use outside of the JDK itself. In the meantime, it seems best to avoid them unless you have a compelling need.”
― quote from Effective Java Programming Language Guide


“Builder pattern is more verbose than the telescoping constructor pattern, so it should be used only if there are enough parameters, say, four or more.”
― quote from Effective Java Programming Language Guide


Popular quotes

“Sandy felt warmly towards Miss Brodie at these times when she saw how she was misled in her idea of Rose. It was then that Miss Brodie looked beautiful and fragile, just as dark heavy Edinburgh itself could suddenly be changed into a floating city when the light was a special pearly white and fell upon one of the gracefully fashioned streets. In the same way Miss Brodie's masterful features became clear and sweet to Sandy when viewed in the curious light of the woman's folly, and she never felt more affection for her in her later years than when she thought upon Miss Brodie silly.”
― Muriel Spark, quote from The Prime of Miss Jean Brodie


“He grunted; she recognized it as relief that she wasn't going to nag him further about Tor the Just, who probably wasn't that boring if he could hold off the Notherners for nine days and melt a hole in the hills.”
― Robin McKinley, quote from The Blue Sword


“I change too quickly: my today refutes my yesterday. When I ascend I often jump over steps, and no step forgives me that.”
― Friedrich Nietzsche, quote from Thus Spoke Zarathustra


“But even things that heal leave scars.”
― Diana Gabaldon, quote from An Echo in the Bone


“A man who lives a part, not to others but alone, is exposed to obvious psychological dangers. In itself the practice of deception is not particularly exacting. It is a matter of experience, a professional expertise. It is a facility most of us can acquire. But while a confidence trickster, a play actor or a gambler can return from his performance to the ranks of his admirers, the secret agent enjoys no such relief. For him, deception is first a matter of self defense. He must protect himself not only from without, but from within, and against the most natural of impulses. Though he earn a fortune, his role may forbid him the purchase of a razor. Though he be erudite, it can befall him to mumble nothing but banalities. Though he be an affectionate husband and father, he must within all circumstances without himself from those with whom he should naturally confide. Aware of the overwhelming temptations which assail a man permanently isolated in his deceit, Limas resorted to the course which armed him best. Even when he was alone, he compelled himself to live with the personality he had assumed. It is said that Balzac on his deathbed inquired anxiously after the health and prosperity of characters he had created. Similarly, Limas, without relinquishing the power of invention, identified himself with what he had invented. The qualities he had exhibited to Fiedler: the restless uncertainty, the protective arrogance concealing shame were not approximations, but extensions of qualities he actually possessed. Hence, also, the slight dragging of the feet, the aspect of personal neglect, the indifference to food, and an increasing reliance on alcohol and tobacco. When alone, he remained faithful to these habits. He would even exaggerate them a little, mumbling to himself about the iniquities of his service. Only very rarely, as now, going to bed that evening, did he allow himself the dangerous luxury of admitting the great lie that he lived.”
― John le Carré, quote from The Spy Who Came In from the Cold


Interesting books

I'm Not Stiller
(3.1K)
I'm Not Stiller
by Max Frisch
Rachel's Holiday
(54.1K)
Rachel's Holiday
by Marian Keyes
Hold Still
(18.2K)
Hold Still
by Nina LaCour
Some Girls Are
(13.2K)
Some Girls Are
by Courtney Summers
At Peace
(24.9K)
At Peace
by Kristen Ashley
Jacob Have I Loved
(27.9K)
Jacob Have I Loved
by Katherine Paterson

About BookQuoters

BookQuoters is a community of passionate readers who enjoy sharing the most meaningful, memorable and interesting quotes from great books. As the world communicates more and more via texts, memes and sound bytes, short but profound quotes from books have become more relevant and important. For some of us a quote becomes a mantra, a goal or a philosophy by which we live. For all of us, quotes are a great way to remember a book and to carry with us the author’s best ideas.

We thoughtfully gather quotes from our favorite books, both classic and current, and choose the ones that are most thought-provoking. Each quote represents a book that is interesting, well written and has potential to enhance the reader’s life. We also accept submissions from our visitors and will select the quotes we feel are most appealing to the BookQuoters community.

Founded in 2023, BookQuoters has quickly become a large and vibrant community of people who share an affinity for books. Books are seen by some as a throwback to a previous world; conversely, gleaning the main ideas of a book via a quote or a quick summary is typical of the Information Age but is a habit disdained by some diehard readers. We feel that we have the best of both worlds at BookQuoters; we read books cover-to-cover but offer you some of the highlights. We hope you’ll join us.