
On the bottom of the copyright page (facing the first page of the table of contents), look for a line such as
First printing, January 2015
In the errata below, we indicate the printing in which the error has been fixed inside square brackets such as [4].
For example, suppose you have the fourth printing. Then you can ignore all reports that are prefixed with [2], [3] or [4]. But you would want to pay attention to all reports that are prefixed with [5] or higher or that have no bracketed prefix at all.
boolean” to “four integer types, two floating-point types,
char, and boolean."char next = (char)('J' + 1); // Converts 75 to 'K'to
int n = 1;
char next = (char)('J' + n); // Converts 75 to 'K'>>
fills the top bits with zero, and >>> extends the sign bit into the top bits.” to There are two right shift operators: >> extends the sign bit into the top bits, and >>> fills the top bits with zero.done = false;to
done = true;
if (n < 0) continue; to if (input < 0) continue;3, 10, 11, 8 to 5, 10, 11, 8short to int, int to long, and “computes” to “computes and displays”3 10 11 8 to 5 10 11 8private ArrayList<Member> members;to
private ArrayList<Member> members = new ArrayList<>();
myFace.enroll("fred") into myFace.enroll("Fred")int difference = first.length() < second.length();change the
< operator to a - operator.Runnable task = () -> { for (int i = 0; i < 1000; i++) doWork(); }Stream.toArray” to “methods such as Stream.toArray”public class Application() to public class Applicationreturn (x, y) -> comp.compare(x, y);to
return (x, y) -> comp.compare(y, x);
} that lines up with returnpublic class ConcurrentWorker extends Greeterto
public class ConcurrentWorker extends Worker
Object.equals(obj, other)” to “the null-safe alternative Objects.equals(obj, other)”equals method overrides Objects.equals” to “Since the equals method overrides Object.equals”public Modifier() { to Modifier() { obj.getDeclaredField("salary") to obj.getClass().getDeclaredField("salary")p.invoke(obj, "********");to
m.invoke(p, "********");
ex.printStackTrace(out);to
ex.printStackTrace(new PrintStream(out));
Logger.global to Logger.getGlobal()printAll(employees, e -> e.toString().length() % 2 == 0);to
Predicate<Object> evenLength = e -> e.toString().length() % 2 == 0; printAll(employees, evenLength);
public void add(String e)to
public boolean add(String e)and
public void add(Object e) {
add((String) e);
} to
public boolean add(Object e) {
return add((String) e);
}public static <V, T> V doWork ...to
public static <V, T extends Throwable> V doWork ...
add to addAll.Collection<K> values() to Collection<V> values()Bitset to BitSet (4x)byte[] toByteArray[] long[] toByteArray[]to
byte[] toByteArray() long[] toLongArray()
Arrays.asList(a) returns a List<T>” to “then Arrays.asList(a) returns a List<E>”Map<String, Set<Integer>> to represent a table of contents?
(Hint: How would you initialize it?) What type can you use instead?” to:Map<String, Set<Integer>>, and someone calls your method with a HashMap<String, HashSet<Integer>>. What happens? What parameter type can you use instead?getOrElse to orElseiterate method” to “You can call the iterator method”Locale::getDisplayLanguage,to
loc -> loc.getDisplayLanguage(loc),
List<Locale>> englishLocales = englishAndOtherLocales.get(true);to
List<Locale> englishLocales = englishAndOtherLocales.get(true);
Map<String, City> stateToLargestCity to Map<String, Optional<City>> stateToLargestCity.filter(s -> s.length() < 10)to
.filter(s -> s.length() < 12)
PrintWriter out = new PrintWriter(outStream, "UTF-8");to
PrintWriter out = new PrintWriter(new OutputStreamWriter(outStream, charset));and remove the sentence that follows.
FileChannel = FileChannel.open(path);to
FileChannel channel = FileChannel.open(path);
Employee peter = new Employee("Fred", 90000);
Employee paul = new Manager("Barney", 105000); to
Employee peter = new Employee("Peter", 90000);
Employee paul = new Manager("Paul", 105000);NumberFormat class is not
threadsafe” to “the NumberFormat class is not
threadsafe”anyOf from “Complete with void result after any of
the given futures completes.” to “Complete after any of
the given futures completes and yield its result.”builder.redirectIO() to builder.inheritIO()toNanos, toMillis, toSeconds, toMinutes” to “by calling toNanos, toMillis, getSeconds, toMinutes”String template = "{0} has {1} messages"Locale.getDisplayDefault() as the locale” to “pass Locale.getDefault(Locale.Category.DISPLAY) as the locale”Thanks to Craig Artley, Lorenzo Bettini, Andrew Binstock, Richard Boyd, Rogerio Brioschi, Jean-Paul Dubois, Scott Firestone, Mikhail Firulin, Ian Gatenby, Lukasz Gorski, Tigran Gularyan, Ben Hadley, Garrett A. Hughes, Grigorii Ivanov, Alain Kreienbuhl, Tony Mathson, Aleksandr Morozov, Christoph Nahr, Stiu Principle, Hans-J. Schmid, Raj Karan Singh, Andrzej Stefanski, Matt Stavola, David Thiele, Suleiman Khan Tischhauser, Serguei Yanush, Mark Zarins, and (your name might go here) for their bug reports and suggestions!
Please use this form to report any bugs that you find. Please check the list of known bugs first before you report a bug. Unfortunately, I do not have the time to respond personally to every report, but I do read them all and will post updates to this page. Thank you!