java stream closed exception

java stream closed exception

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());
Sour‮c‬e:www.lautturi.com
Created Time:2017-09-02 13:35:24  Author:lautturi