Most efficient way to get the last element of a stream February 8, 2023 by Tarik Do a reduction that simply returns the current value: Stream<T> stream; T last = stream.reduce((a, b) -> b).orElse(null);