I have been trying to access the elements of several arrays that are held within an array list. I am able to access it regularly, but the problem comes when I use generic type E to account for different data types. This gives me a class cast exception. If I change the type of tempStart and tempScan and corresponding casts to int[] (since that is what I am using to pass in) it runs.
public static <E> ArrayList<E> removeDuplicates(ArrayList<E> list) {
    if (list.get(0).getClass().isArray()) {
        System.out.println(" I am an array!");
        //go through the arrays and make sure they are 
        //not the same, remove any that are the same
        //make flag to see if something is different
        boolean matching;
        for (int idx = 0; idx < list.size() - 1; idx++) {
            E[] tempStart =(E[])list.get(idx);
            for (int k = idx + 1; k < list.size(); k++) {
                matching = true;
                E[] tempScan = (E[])list.get(k);
                for (int index = 0; index < tempStart.length; index++) {
                    if (tempStart[index] != tempScan[index]) {
                        matching = false;
                    }
                }
                if (matching) {
                    list.remove(tempScan);
                    k--;
                }
            }
        }
 
    