eh3rrera / ocpj8-book

Study guide for the Oracle Certified Professional, Java SE 8 Programmer Exam (1Z0-809)
Other
129 stars 90 forks source link

Typos #69

Closed akudrin closed 5 years ago

akudrin commented 6 years ago

Hi,

Thank you for sharing such a great resource!

I think I found a few typos in Chapter 10.

In Predicate sections it says :

So instead of using:

Predicate even = t -> t % 0 == 1; boolean result = even.test(5);

You can use:

IntPredicate even = t -> t % 0 == 1; boolean result = even.test(5);

Both options throw an ArithmeticException / by zero.

In BiConsumer section the code is:

Here's an example using an anonymous class:

BiConsumer<String, String> consumeStr = new Consumer<String, String>() { @Override public void accept(String t, String u) { System.out.println(t + " " + u); } }; consumeStr.accept("Hi", "there");

But Consumer and BiConsumer not in the same inheritance tree. This code does not compile.

Thank you!

eh3rrera commented 6 years ago

You're right, in the first case it should be t -> t % 2 == 1.

In the second case, BiConsumer.

Thanks! 👍