I want to display the second element of the stream for which the name begins with 's'.
I tried:
employees.stream()
.filter(e -> e.getName().charAt(0) == 's')
.findAny()
.ifPresent(e -> System.out.println("Employee : " + e));
However, when I use it findAny(), it returns the first element in the stream (same as findFirst()), and I want the second.
source
share