If you're open to using a 3rd party library and would like to avoid boxing the int values as Integer objects, you could use primitive lists in Eclipse Collections.
int[] values = {4, 5, 2, 3, 42, 60, 20};
IntList list = IntLists.mutable.withAll(
Arrays.stream(values).filter(value -> value > 4));
Assertions.assertEquals(IntLists.mutable.with(5, 42, 60, 20), list);
You can also convert the IntStream to an IntArrayList using the collect method, but it is more verbose.
IntList list = Arrays.stream(values).filter(value -> value > 4)
.collect(IntArrayList::new, IntArrayList::add, IntArrayList::addAll);
Assertions.assertEquals(IntLists.mutable.with(5, 42, 60, 20), list);
You can also just construct the primitive list directly from the primitive array, and use the select method which is an inclusive filter.
IntList list = IntLists.mutable.with(values).select(value -> value > 4);
Assertions.assertEquals(IntLists.mutable.with(5, 42, 60, 20), list);
I have blogged about primitive collections in Eclipse Collections here.
Note: I am a committer for Eclipse Collections.