Skip to content

Instantly share code, notes, and snippets.

@yuizho
Created November 23, 2019 07:19
Show Gist options
  • Save yuizho/de2cffb514a774f32819c108934425e5 to your computer and use it in GitHub Desktop.
Save yuizho/de2cffb514a774f32819c108934425e5 to your computer and use it in GitHub Desktop.
Stream<String> stream =
Arrays.asList("a", "b", "c").stream()
.filter(s -> !s.equals("a"));
System.out.println(stream.collect(Collectors.toList()))
// ココでエラーになる
// java.lang.IllegalStateException: stream has already been operated upon or closed
System.out.println(stream.collect(Collectors.toList()));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment