Java 8 for the Really Impatient

Bug Report Page

.

How to Tell which Printing You Have

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 2014

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.

Page 6 [2]
Change “can be passed to a functional interface.” to “can be converted to a functional interface.”
Page 8, 9, 18, 25 [2]
Change “method expression” to “method reference”
Page 9 [2]
Change “you can capture the this reference of an enclosing class” to “you can invoke a method of an enclosing class or its superclass”
Page 9
Change “into an array of buttons” to “into a list of buttons”
Page 13 [2]
Change public class Application() to public class Application
Page 17 [2]
Change Comparator.comparing(Person::name) to Comparator.comparing(Person::getName)
Page 17 [2]
Change Comparator.compare(String::length) to Comparator.comparing(String::length)
Page 17
Change “The compare method turns a function (the key extractor)” to “The comparing method turns a function (the key extractor)”
Page 18 [2]
Change “the uncheck function” to “the uncheck method”
Page 19 Exercise 9 [2]
Change “subclass” to “subinterface”
Page 23 [2]
Change paralleStream to parallelStream
Page 24
Change “to make stream” to “to make a stream”
Page 28
Change “These methods always examine the entire stream, but they still benefit from being run in parallel.” to “These methods also benefit from being run in parallel.”
Page 29 [2]
Change “There is a second form of the ifPresent method” to “Besides the isPresent method, there is an ifPresent method”
Page 30
Change “has type Optional<T>,has not T” to “has type Optional<T>, not T
Page 30 [2]
In the last line, change Optional<U> = to Optional<U> result =
Page 31 [2]
Change Double result to Optional<Double> result (2x)
Page 32 [2]
Add a semicolon after Integer sum = values.reduce(0, (x, y) -> x + y)
Page 33 [2]
Change “An combiner” to “A combiner
Page 37
List<Locale>> englishLocales should be List<Locale> englishLocales.
Page 37
Change Map<String, City> stateToLargestCity to Map<String, Optional<City>> stateToLargestCity
Page 38
Change “In the first form, the identity is null. (Note that this is different from the forms of Stream::reduce, where the method without an identity parameter yields an Optional result.)” to “In the first form, the reduction yields Optional results, even though the groups can never be empty.”
Page 40 [2]
Change Integer.range to IntStream.range
Page 42 [2]
Change public interface Predicate to public interface Predicate<T>
Page 44 [2]
Change System.currentTimeMillis to System.nanoTime
Page 44 Exercise 11
Remove “provided it has been constructed with the stream’s size” and change “How can you achieve that?” to “Why is it not possible to implement a Collector that fills a given array list of sufficient capacity?”
Page 51 [2]
In the table, change chain to andThen (2x). In the entry for BinaryOperator<T>, add maxBy, minBy to the “Other Methods” column.
Page 54, 65 [2]
Change BiFunction<Color, T> to BiFunction<Color, T, Color>
Page 57
Change “Exercises 12 and 13” to “Exercises 12 - 14”
Page 58 [2]
Change “to let the expression bubble up” to “to let the exception bubble up”
Page 61 [2]
Change situtation to situation
Page 65 Exercise 10
Change UnaryOperator to UnaryOperator<Color>
Page 66 Exercise 14
Change reader.get(width - x, y) to reader.getColor(width- 1 - x, y) and reader.get(x, y).grayscale() to reader.getColor(x, y).grayscale()
Page 66 Exercise 14
Change UnaryOperation<Color> to UnaryOperator<Color>.
Page 71 [2]
Change “NOTE: Note that there are no” to “NOTE: There are no”
Page 75 [2]
Change “The ChangeListener callback tells you the old and new value, which means it has to compute the new value. The InvalidationListener doesn’t compute the new value, but that means you might get a callback when the value hasn’t actually changed.” to “The ChangeListener callback tells you the old and new value, which means its caller has to compute the new value. The code that notifies an InvalidationListener doesn’t compute the new value, but that means you might get a callback when the value hasn’t actually changed.”
Page 80 [2]
Change “North, West, South, East” to “Top, Bottom, Left, Right”
Page 81
Change “in the South area” to “in the bottom area”
Page 83 [2]
Change “The buttons are in an HBox that spans two rows.” to “The buttons are in an HBox that spans two columns.”
Page 83 [2]
In the last 3 lines, change 0.8 * em to 0.8 * rem
Page 84 [2]
Change “North, East, South, West” to “Top, Bottom, Left, Right”
Page 86
Make the second and third GridPane line up with the first.
Page 89
Change http://docs.oracle.com/javafx/2/api/javafx/scene/doc-files/cssref.html to https://docs.oracle.com/javase/8/javafx/api/javafx/scene/doc-files/cssref.html
Page 98 Exercise 5
Change t >= 100 to t.doubleValue() >= 100
Page 102 [2]
Change "microsocopic" to "microscopic"
Page 103
Change “by calling toNanos, toMillis, toSeconds, toMinutes” to “by calling toNanos, toMillis, getSeconds, toMinutes
Page 103
In Table 5-1, change the second and third rows as follows:
plusNanos, plusMillis, plusSeconds,
minusNanos, minusMillis, minusSeconds
Adds or subtracts a number of the given time units to this Instant or Duration.
plusMinutes, plusHours, plusDays,
minusMinutes, minusHours, minusDays
Adds or subtracts a number of the given time units to this Duration.
Page 105, 111 [2]
In Table 5-2 and 5-5, change the entry for “plus, minus” from “Adds a Duration or Period” to “Adds or subtracts a Duration or Period”
Page 107
In Table 5-3, remove lastDayOfPreviousMonth(),
Page 108 [2]
In Table 5-4, change the entry for “plus, minus” from “Adds a Duration” to “Adds or subtracts a Duration”
Page 109
Change ZoneId.getAvailableIds() to ZoneId.getAvailableZoneIds()
Page 111 [2]
In Table 5-5, change the entry for “minusDays, ...” from “Subtracts a number of temporal units from this LocalDate” to “Subtracts a number of temporal units from this ZonedDateTime
Page 115 [2]
Change particularicular to particular
Page 117 [2]
Change ZoneId.getAvailableIds() to ZoneId.getAvailableZoneIds()
Page 125 [2]
Remove “Since putIfAbsent returns the mapped value (either the existing one or the newly put one), you can combine the two statements: map.putIfAbsent(word, new LongAdder()).increment();”. (Actually putIfAbsent always returns the old value, which is null when it was absent.)
Page 126 [2]
In the bulleted list, change operationKeys to searchKeys/reduceKeys/forEachKey, operationValues to searchValues/reduceValues/forEachValue, operation to search/reduce/forEach, operationEntries to searchEntries/reduceEntries/forEachEntry.
Page 126 [2]
Near the bottom of the page, change BiFunction to Function in the entries for searchKeys, searchValues, and searchEntries (but leave it as BiFunction for search).
Page 129 [2]
Change values.parallelSort(values.length / 2, values.length); to Arrays.parallelSort(values, values.length / 2, values.length);
Page 130 [2]
Change public void Future<String> readPage(URL url) to public Future<String> readPage(URL url)
Page 130 [2]
Change CompleteableFuture to CompletableFuture
Page 130, 132 [2]
Change CompletableFuture<List<String>> to CompletableFuture<List<URL>>
Page 143
Change “For example, 'Hello'.slice(-2.99) is the same as 'Hello'.slice(-2).” to “For example, 'Hello'.charAt(2.99) is the same as 'Hello'.charAt(2).”
Page 162 [2]
Change “NavigableSet and NavigableMap classes” to “NavigableSet and NavigableMap interfaces”, and “Now the Collections class supports these classes” to “Now the Collections class supports these interfaces”.
Page 167 [2]
Add a comma after @PrimaryKeyJoinColumn(name="ID")
Page 171 [2]
Change Object::isNull to Objects::isNull and Object::nonNull to Objects::nonNull
Page 170
Change List<? extends @ReadOnly> Person to List<? extends @ReadOnly Person>
Page 174
Change “for Statement and ResultSet” to “for ResultSet, PreparedStatement, and CallableStatement”. Change “the corresponding setObject” to “the corresponding updateObject/setObject”.
Page 187 [2]
Change “The call path.exists() method checks whether...” to “The call Files.exists(path) checks whether...”
Page 187
Change “The call Files.exists(path) method checks...” to “The call Files.exists(path) checks...” [This wasn't done quite right in the second printing.]
Page 189
Change “simply calls Arrays.hash” to “simply calls Arrays.hashCode
Page 189 (2x) [2]
At the end of the second note, replace Object.toString by Objects.toString
Page 190
Change “the feature that caught everyone’s imagination were applets” to “the feature that caught everyone’s imagination was applets”
Page 197
Change Integer.compareTo to Integer.compare

Thanks to Tommy Becker, Peter Bonney, Jeanne Boyarsky, Joel Caplin, Chee Cheng, Jim Cohoon, Alexandru Cojocaru, Raghavendra Desoju, Jingjing Duan, Markus Falkhausen, Richard Grin, Philip Hodges, Simon Hogg, Michael Inden, Piotr Jaczewski, Raffi Khatchadourian, George Latkiewicz, Songxun Lin, Herouth Maoz, Ari Meyer, Stevens R. Miller, Derek Mortimer, Kohei Nozaki, Ronald Plöger, Mike Rainville, Edward Roques, Yoshiki Shibata, Gene Small, Mikhail Sokolov, Fabian Spinnenhirn, Daisuke Suko, Thalita Vergilio, and (your name might go here) for their bug reports and suggestions!

Bug Report Form

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!

Your name:

Your email address:

Page number:

Problem description:

To protect against spam robots, please answer this simple math problem:
* =