Код: Выделить всё
public void doTest(ArrayList items) {
// I know that I should check the count of items. Let's say the count is 10.
double max = IntStream.range(1, 5)
.mapToDouble(i -> items.get(i) - items.get(i - 1))
.max().getAsDouble();
}
Подробнее здесь: https://stackoverflow.com/questions/636 ... e-in-swift