Created
September 19, 2018 14:40
-
-
Save michael-simons/412a24aae8ad6601312f1c63e3c93393 to your computer and use it in GitHub Desktop.
JDK11 String#isBlank and Predicate.not
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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