int array to map java code example
Example: int array to map java
Map<Integer, Long> map = Arrays
.stream(nums)
.boxed() // this
.collect(Collectors.groupingBy(e -> e, Collectors.counting()));
Map<Integer, Long> map = Arrays
.stream(nums)
.boxed() // this
.collect(Collectors.groupingBy(e -> e, Collectors.counting()));