Can you improve the performance of the Stream filter code below?
private static LinkedList<Integer> ll;
private static void filterQ() {
ll = new LinkedList<>();
IntStream.range(0, 100).forEach((i) -> ll.add(i));
ll = ll.stream().filter((i) -> i != 10 )
.collect( Collectors.toCollection(LinkedList::new) );
}
You can find the answer here
private static LinkedList<Integer> ll;
private static void filterQ() {
ll = new LinkedList<>();
IntStream.range(0, 100).forEach((i) -> ll.add(i));
ll = ll.stream().filter((i) -> i != 10 )
.collect( Collectors.toCollection(LinkedList::new) );
}
You can find the answer here
Comments
Post a Comment