Last active
August 27, 2019 15:24
-
-
Save yavuztas/aaf5dff20294e0b4f5e8d3cf321ba74b to your computer and use it in GitHub Desktop.
Created with Copy to Gist
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
public static <T> List<T> filterArray(T[] array, Predicate<? super T> predicate) { | |
return Arrays.stream(array) | |
.filter(predicate) | |
.collect(Collectors.toCollection(ArrayList::new)); | |
} | |
public static <T> List<T> filterCollection( | |
Collection<T> collection, Predicate<? super T> predicate) { | |
return collection.stream() | |
.filter(predicate) | |
.collect(Collectors.toCollection(ArrayList::new)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment