I am creating a Supplier Stream of String and working on the same.
public void test(Stream<String> s) {
Supplier<Stream<String>> streamSupplier = () -> s;
System.out.println(streamSupplier.get().count());
streamSupplier.get().parallel()
.collect(Collectors.groupingBy(it -> counter.getAndIncrement() / 2))
.values()
.stream()
.forEach(input -> {
System.out.println("input " + input);
});
I am getting an error "stream has already been operated upon or closed" when I try to work with the stream. How can I resolve this. Thank you.