Java: making List from primitive array using Stream API
问题 I'm trying to make a List from a primitive array int[] values={4,5,2,3,42,60,20}; List<Integer> greaterThan4 = Arrays.stream(values) .filter(value -> value > 4) .collect(Collectors.toList()); But the last function collect gives me an error because it wants other arguments. It wants 3 arguments Supplier, ObjIntConsumer and BiConsumer. I don't understand why it wants 3 arguments when I have seen different examples that just use collect(Collectors.toList()); and get the list. What I'm doing