I'm trying to figure out how to get the frequency of items within a list. When I approach this problem I typically, in the past, did:
int occurrences = Collections.frequency(list, 0);
It works when my list is a List<Integer> list
. Is there a way to do this if I'm using int[] list
? When I try collections, my list gets converted and then my code breaks. I can convert my code if needed, but was wondering, if there was a way to get the frequency from int[] instead.