I need to create a method to return an int array by casting from the ArrayList. Here is my code:
public int[] getDestSets()
{
int[] array = new int[destSet.size()];
destSet.toArray(array);
return array;
}
destSet is an integer ArrayList. I got the error "The method toArray(T[]) in the type ArrayList is not applicable for the arguments (int[])". Can anyone give me a hint? Thanks!