От: | bzig | ||
Дата: | 17.03.17 02:18 | ||
Оценка: |
{
System.out.println("readability: bad, performance O(n) for all lists");
list.stream().reduce((p,n) -> {
if (n > 0) action.accept(n, p);
else if (p != null && p < 0) action.accept(p, n);
return n;
}).ifPresent(p -> {if (p < 0) action.accept(p, null);});
}