I am trying to remove items from a 3 dimensional array.
I understand that one of the best ways to do this is to convert the array to a list and whilst iterating through the original array remove those items from the list then convert the list back to an array and return it.
I tried this but got an type mismatch when coming back to the array. I suspect I have not done something with the dimensions when converting from array to list.
Advice?
import java.util.List;
import java.util.Arrays;
public class RepatitionRemoval {
public float[][][] process(float[][][] data) {
//this method with step through all of the the strokes and remove
//points which occupy the same position. This should help with time
//warping regconition
//Change the array to a list
List points = Arrays.asList(data);
for (int i = 0; i < data.length; i++) {
for (int j = 0; j < data[i].length; j++) {
for (int k = 0; k < data[i][j].length-1; k++) {
//if the current coordinate is the same as the one next
//then remove it
if (data[i][j][k] == data[i][j][k+1]) {
points.remove(data[i][j][k]);
}
}
}
}
float[][][] returnData = points.toArray();
return returnData;
}
}