Skip to content

Instantly share code, notes, and snippets.

@michael-simons
Created September 19, 2018 14:40
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 michael-simons/412a24aae8ad6601312f1c63e3c93393 to your computer and use it in GitHub Desktop.
Save michael-simons/412a24aae8ad6601312f1c63e3c93393 to your computer and use it in GitHub Desktop.
JDK11 String#isBlank and Predicate.not
import java.util.List;
import java.util.function.Predicate;
public class Test {
public static void main(String...a) {
var strings = List.of("foo", " ", "bar", "", "\t");
var isNotBlank = Predicate.not(String::isBlank);
strings.stream().filter(isNotBlank).forEach(System.out::println);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment