Active Threads This:
Most Active This Week
Most Active This Month
Most Active This Year
Most Active Last Three Years
Just some thoughts on being hard on exceptions in functional languages.
On p. 167 we read:
Functional style code is amazing, concise, ...
New
As for FinanceData on page 91, the code for AirportInfo uses the suspect and soon-to-be-deprecated java.net.URL. Let’s use java.net.URI i...
New
It turns out that Try<T> can be ameliorated by judicious application of subclassing: no need to distinguish by actual type in the s...
New
Nothing surprising here, just adapting the form to the other examples.
Ah yes, compute() now returns an immutable list in all cases.
pa...
New
The filter stream operation appears on several places in Chapter 2 and Chapter 3, so it’s difficult to say where to put this, but there s...
New
I have been thinking about how to collect “two adjacent elements” in a stream, for example transform a stream of Long into a stream of Pa...
New
Suggestions for some JUnit test improvements in Refactoring the Traditional “for” loop p 181 ff
Below code for testing the original/cla...
New
We read:
We are using the amazing feature of the switch expression of Java [Java 12]. If you’re using an older version of Java, you may...
New
A question to highlight is:
Is there a way to make sure that a stream is NOT parallel, and make this evident in the code?
As in:
strea...
New
As traditional , the “impure” code of page 207 in the form of a pretend test.
(Doesn’t “impure” refer to performing uncontrolled side ef...
New
Although now aged by 34 years:
“The Conception, Evolution, and Application of Functional Programming Languages”
by Paul Hudak (1989-09-...
New
I had real trouble understanding the “memoizer”, I suppose Java syntax does not help in thinking about what should be a one-liner in Lamb...
New
As usual, but the original code to be refactored was just too evil and had to be fixed.
package chapter11;
import org.junit.jupiter.api...
New
Nothing special here, same changes as formerly, but we are using people.isEmpty() instead of people.size() == 0 for even better legibilit...
New
The same remarks apply as for “Refactoring the Traditional for Loop”
No init()
Classes under test implement a common interface that is...
New
Most Active Over Three Years
The same remarks apply as for “Refactoring the Traditional for Loop”
No init()
Negative tests which apply for input less than 1900, res...
New
In this code:
We actually create the (temporary) file we want to read and delete it again at the end.
Default charsets for reading text...
New
The example on page 125 comes closest to the mythical “self-modifying code” (a completely useless concept as modifying the data structure...
New
Again, some code suggestions for “Chapter 4”, similar to “Chapter 3”
(one would wish to have better markdown syntax highlighting to make...
New
The usual changes but:
The “FirstRepeatedLetter.findIn()” has been improved out of the box. In particular returning ‘\0’ is too C-like ...
New
We read:
public static void betterWay() {
List<File> files =
Stream.of(new File(".").listFiles())
.fla...
New
Suggesting a text change:
We read:
We’ve registered a WatchService to observe any change to the current directory.
but what actually...
New
On page 103, the code for FluentMailer provides a static method which is basically a service that (opaquely) instantiates a FluentMailer,...
New
In Chapter 9, p.164 the stream is parallelized in 1 step.
This inspired my to write some test some code to call a task “in parallel”:
...
New
On page 55, we see Compare.java
final Function<Person, String> byName = person -> person.getName();
people.stream()
.sorted(...
New
This is no particular interest but here is some code that uses the “execute around” pattern to build a timer to time the “primes generato...
New
On page 15, we read:
In this example we’re sending a function, price -> price * 0.9, as an argument to mapToDouble The function bein...
New
I suggest this nicer code for the Statistics.java on page on page 70 (we are doing streams after).
Not using a main() but a JUnit 5 Test...
New
This may be too extensive to change, but I would like to see the code example not as a series of classes with main() but as JUnit test cl...
New
The text says “oldest” but the code says “eldest”.
Not that it is of much importance.
New
Book Info
Publisher:
Pragmatic Bookshelf
Are you this book's author? To be notified of all posts made about it, sign up an account then click here, then select 'watching' from the bell icon in the top right corner.
Get money off!
The Pragmatic Bookshelf
35% off any eBook
Simply use coupon code "devtalk.com" at checkout. See full details here.