diff --git a/src/main/java/fi/solita/utils/functional/FunctionalImpl.java b/src/main/java/fi/solita/utils/functional/FunctionalImpl.java index c0cc0e7..6f6546b 100644 --- a/src/main/java/fi/solita/utils/functional/FunctionalImpl.java +++ b/src/main/java/fi/solita/utils/functional/FunctionalImpl.java @@ -412,7 +412,7 @@ static final > Option reduce(Iterable xs) } static final T reduce(Monoid monoid, Iterable xs) { - return xs == null ? null : fold(monoid, cons(monoid.zero(), xs)).get(); + return fold(monoid, xs).getOrElse(monoid.zero()); } static final Z fold(Z zero, Apply, Z> f, Iterable xs) {