Can someone tell me what I am doing wrong here? p.getVote()
, and the collection counting logic return a Long, but I am trying to make my end output an array of ints.
Map<Integer, Long> counters = iqr.getQgagueUniqueVotes().stream()
.collect(Collectors.groupingBy(p -> ((int)p.getVote()),
Collectors.counting()));
Collection<Long> values = counters.values();
long[] targetArray = values.toArray(new Long[values.size()]);
Error:
Incompatible type: Inference variable has incompatible upper bound