JList declares a method : public void setSelectedIndices(int[] indices)
Which according to Oracle's documentation changes :
the selection to be the set of indices specified by the given array
I know that a Set can not take primitive int as a generic type.
How to retrieve the indices I want to select?
For now, I use a Set<Integer>, loop through the rows and when a row is selected a add it to the Set<Integer>.
But then, I must convert the Set<Integer>into a int[] and there is no built-in function to do that. I already know how to do the translation.
Does anyone who uses public void setSelectedIndices(int[] indices) has to develop his own converter or use ones of Guava or Apache ?
This seems to be a flaw in Swing. Is there any reason why this method can not take a Set or even a List ?
Or is there a way to create a set of primitive that I don't know ?
Wouldn't it be better for every developer if the method took a Set<Integer> as argument ? Why isn't the case ?