Hacker News new | ask | show | jobs
by fortpoint 3751 days ago
In Java it would look like this:

List<Double> newshipping = oldshipping.stream().filter(i -> i % 2 == 1).map(i -> i + 0.5d).collect(Collectors.toList());

a bit more verbose but the essential chaining idea is there...

1 comments

The above, only if you want to discard (filter) orders with an even number of things.

Also I'm not sure about the use of floating point here...