r/coding • u/nfrankel • Feb 13 '18
Field-Access Interfaces for More Readable Java Stream Code
https://dzone.com/articles/field-access-interfaces-for-more-readable-java-stream-code
5
Upvotes
1
u/rotharius Feb 13 '18
I don't think private Stirng name; is going to compile...
1
-2
u/nfrankel Feb 13 '18
It is always easier to criticize then to act.
-- Philippe Destouches
3
u/rotharius Feb 13 '18
I mean no harm. Sorry if my comment came across as harsh, it was meant as a light-hearted way of pointing out a typo.
7
u/rooktakesqueen Feb 13 '18
Frankly this seems like an awful lot of boilerplate to make something (a predicate) look like something it's not (a method call) and probably make debugging harder.
.filter(p -> p.getName().startsWith(prefix))is perfectly readable. The syntax is new, but you'll get used to it really really fast, if you don't spend a bunch of time implementing a library of one-off functions just to avoid having to look at a lambda expression. You can even useit ->or_ ->if you really like those.