Layne Patel

Greenhorn
+ Follow
since Apr 27, 2020
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
1
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Layne Patel

Yes, certainly, Jeanne

P.158 Chapter 3: The second paragraph  should be: “For computeIfAbsent(), the functional interface runs only when the key isn’t present or value is null”.

P.204 Chapter 4 Table 4.5: The “Destructive to Stream” column of row 3 s.peek(System.out::println).count() should say Yes, because count() is a terminal operation

P. 251 Chapter 5 Figure 5.2: In the last rectangle of November changeover line the time should be: 2:00-3:00 (not 2:00-4:00)

P. 310 Chapter 6 Note: The last sentence in Note should be: “ Keep an eye out for a question that contains assert statement but that is not executed with assertions disabled (not enabled); the assert statement is ignored in that situation”

P. 314 Chapter 6: The last sentence should be: “You saw how the -ea and -enableassertions (not  -enableassertion) flags turn on assertions.

P. 341 Chapter 7  Code snippet: There should be also catch-blocks for InterruptedException and Execution Exception, because V get(long timeout, TimeUnit unit) method invoked on Future object throws InterruptedException, ExecutionExeption and TimeoutException

P.346 Chapter 7  Second paragraph : The second sentence should begin “ScheduledFuture<V> is identical to the Future<V> interface (not class)

P.372 Chapter 7 Third paragraph: The last sentence should be “In fact, they (stateful operations) should generally be avoided in parallel (not serial) streams wherever possible, since they prevent your streams from taking advantage of parallelization”, because stateful lambda expression in parallel stream produces unpredictable results at runtime

P.478 Chapter 9 First paragraph : The first sentence should be “Be aware that the entire file is read when readAllLines() is called, with the resulting String list (not array) storing all of the contents of the file in memory at once”, because the return type of readAllLines()-method is List<String>
In the first paragraph, third line  - 'overriding' should stay instead of 'overridden': “Due to the rules of method overriding, this does not require exception to be declared in the overriding method in the Eagle class.”
Hello,

Second sentence perhaps should be: “Since IE is not a superclass of Firefox, this throws ClassCastException” (i.e. not subclass), because if IE were a subclass of Firefox -  it would throw ClassCastExcetion. But if IE were a superclass of Firefox and subclass of Browser  - e.go() would print out “Inside Firefox” and no Exception would be thrown:

public class Browsers {
static class Browser {
public void go() {
System.out.println("Inside Browser");
}
}
static class IE extends Browser {
public void go() {
System.out.println("Inside IE");
}
}
static class Firefox extends IE {
public void go() {
System.out.println("Inside Firefox");
}
}
public static void main(String[] args) {
Browser b= new Firefox();
IE e=(IE)b;
e.go();
}
}
Output: Inside Firefox