There are 2 int [] arrays containing Drawable elements.
int[] m1 = new int[]{R.drawable.img1, R.drawable.img2, R.drawable.img3} int[] m2 = new int[]{R.drawable.img1, } It is necessary to find the difference, compare those 2 arrays and leave only non-repeating elements.
The order is not important. Duplication of values in arrays is excluded. It is initially known that M1 contains 50 elements of M2, they only need to be removed from there.
For a long time there was no answer, I decided like this: Thanks for the help.
private int[] delArray(int[] a, int[] b) { List<Integer> list_A = new ArrayList<Integer>(); for (int index = 0; index < a.length; index++) { list_A.add(a[index]); } List<Integer> list_B = new ArrayList<Integer>(); for (int index = 0; index < b.length; index++) { list_B.add(b[index]); } list_A.removeAll(list_B); int[] ret = new int[list_A.size()]; for(int i = 0;i < ret.length;i++) ret[i] = list_A.get(i); return ret; }
Set.removeAllwill help you in the simplest case, but it does not preserve the order and does not allow duplication of elements - awesoon