I am trying to convert an ArrayList to ArrayList. I am having actually a list of labels in Double and I want to create a list of Integers. I am trying to add the one to another but of course I need a casting process.
ArrayList<Integer> lab = new ArrayList<Integer>();
lab.addAll(labels.data); //labels.data is an Arraylist of Doubles.
How can I cast one list to another?? I ve tried this to add one by one:
ArrayList<Integer> lab = new ArrayList<Integer>();
for (int i = 0; i < labels.data.size(); i++) {
lab.set(i, labels.data.get(i).intValue());
}
But I received outOfBoundsError.