I have an array of int:
int[] a = {1, 2, 3};
I need a typed set from it:
Set s;
If I do th
The question asks two separate questions: converting int[] to Integer[] and creating a HashSet from an int[]. Both are easy to do with Java 8 streams:
int[] array = ...
Integer[] boxedArray = IntStream.of(array).boxed().toArray(Integer[]::new);
Set set = IntStream.of(array).boxed().collect(Collectors.toSet());
//or if you need a HashSet specifically
HashSet hashset = IntStream.of(array).boxed()
.collect(Collectors.toCollection(HashSet::new));