I have an array of int:
int[] a = {1, 2, 3};
I need a typed set from it:
Set s;
If I do th
Or you could easly use Guava to convert int[]
to List<Integer>
:
Ints.asList(int...)
asList
public static List<Integer> asList(int... backingArray)
Returns a fixed-size list backed by the specified array, similar to
Arrays.asList(Object[])
. The list supportsList.set(int, Object)
, but any attempt to set a value tonull
will result in aNullPointerException
.The returned list maintains the values, but not the identities, of
Integer
objects written to or read from it. For example, whetherlist.get(0) == list.get(0)
is true for the returned list is unspecified.