Errata

A Functional Approach to Java

Errata for A Functional Approach to Java

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date submitted
Printed, PDF Page p. 30
Section "Bound non-static method references", first code sample

I have some issues understanding the following code section:
```
// LAMBDA BASED ON EXISTING OBJECT
Predicate<LocalDate> isAfterNowAsLambda = date -> $.isAfter(now);

// BOUND NON-STATIC METHOD REFERENCES
Predicate<LocalDate> isAfterNowAsRef = now::isAfter;
```

1. The $ character does not seem to be valid Java, the line does not compile and $ is never explained. Did you mean "date -> date.isAfter(now);" instead?

2. I understand that the expression "now::isAfter" is equivalent to "now.isAfter(lambdaArgument)". But that is the exact opposite of 1. In 1, you test if "date" is after "now", now you test if "now" is after "date". So these two lines are not equivalent, but opposites?

3. The variable name "isAfterNowAsRef" is at least misleading, because you test if "now" is after a given value, not if a given value is after "now". So it should be "isBeforeOrEqualToNowAsRef" instead?

Fabian Hartmann  Apr 30, 2024