There are two arraylists:
ArrayList<Integer[]> arr1 = new ArrayList<Integer[]>();
ArrayList<Integer[]> arr2 = new ArrayList<Integer[]>();
arr1.add(new Integer[]{1,2,3});
arr1.add(new Integer[]{1,2,2});
arr1.add(new Integer[]{1,2,3});
arr1.add(new Integer[]{1,1,1});
arr1.add(new Integer[]{1,1,1});
arr2.add(new Integer[]{1,2,3});
arr2.add(new Integer[]{1,2,2});
How to delete rows from arr1 that appear in arr2 and that are non-unique in arr1? E.g. in this example I would need to delete only {1,2,3}, because it appears more than once in arr1. The only solution that comes to my mind is to use 4 FOR loops, but it seems to be very inefficient solution.
Edit#1
Resulting arr1: {1,2,3},{1,2,2},{1,1,1},{1,1,1}
In case if you can use a
Listinstead of array then you could do something as follows:Output: