Skip to content

Instantly share code, notes, and snippets.

@ru-rocker
Created December 18, 2016 13:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ru-rocker/2ff356e1e75c2457f511b985966b78f2 to your computer and use it in GitHub Desktop.
Save ru-rocker/2ff356e1e75c2457f511b985966b78f2 to your computer and use it in GitHub Desktop.
Stream<Integer> stream = Stream.of(1, 2, 3, 4);
boolean anyMatch = stream.anyMatch(s -> s > 0);
System.out.println(anyMatch);
// true
boolean noneMatch = stream.noneMatch(s -> s > 0);
System.out.println(noneMatch);
// java.lang.IllegalStateException: stream has already been operated upon or closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment