Closed akudrin closed 5 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!
You're right, in the first case it should be t -> t % 2 == 1.
t -> t % 2 == 1
In the second case, BiConsumer.
BiConsumer
Thanks! 👍
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!