As I have an ArrayList of int arrays which contains duplicates, I\'d like to use HashSet. Unfortunately, I can\'t manage to use HashSet as I wish:
System.out
That's because HashSet uses .equals() to see if a new object is duplicated (and .hashCode() to determine the "bucket").
When you work with arrays, please be aware that new int[]{1,2,3} is NOT "equal to" new int[]{1,2,3}.
The proper way to "deep compare" arrays is via Arrays.equals(a, b) method.
To solve your problem situation effectively you should create a wrapper class which contains your int[] array and then implement .hashCode() and equals() properly.