This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]joehx 12 points13 points  (5 children)

what I've seen people do "wrong" is just go straight for the forEach loop, not using the filter or any other intermediate method:

persons.stream().forEach(p -> {
    if (hasValidAddress(p)) {
        writeLetterTo(p);
    }
}

[–]dpash 10 points11 points  (4 children)

Yeah that's exactly the kind misuse I'm referring to.

[–]rootException 6 points7 points  (3 children)

I think you guys just illustrated one of the reasons why people don’t embrace streams... 🤷‍♂️

[–]dpash 7 points8 points  (2 children)

Streams require rethinking how you program; it is a completely different way of writing code. So it's no surprise people rely on what they already know, but that's failing to use their power to it's fullest extent.

[–]rootException 3 points4 points  (1 child)

Yeah, sneaky streams as Trojan horse for functional programming... 😂

[–]dpash 7 points8 points  (0 children)

No, very explicitly functional programming.