posted 7 years ago
Just before this sentence, there is another typo. "Then we then want them sorted". Should be ""Then we want them sorted".
But even if you fix both typos, these 3 sentences that go one after another don't sound very well: "Then we want them sorted. Then we want the first two. Then we want to print them out".
This is the explanation for the following snippet:
stream.filter(n -> n.length() == 4).sorted().limit(2).forEach(System.out::println);
I think it'd be better to slightly change the wording, e.g. "Then we want to process only two elements".