Caused by: java.lang.IllegalStateException: stream has already been operated upon or closed
Supplier<Stream<String>> streamSupplier = () -> Stream.of("A", "B", "C", "D"); Optional<String> result1 = streamSupplier.get().findAny(); System.out.println(result1.get()); Optional<String> result2 = streamSupplier.get().findFirst(); System.out.println(result2.get());Source:www.lautturi.com