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
Add each number individually. Don't add Arrays to HashSet
int[] arr1 = {1,2,3};
int[] arr2 = {1,2,3};
System.out.println(arr1==arr2);//false
System.out.println(arr1.equals(arr2)); //false
Two arrays with same values need not be equal (they use default equals() method defined in Object which compares references.)