This is a pretty common question, but I could not find this part:
Say I have this array list:
List arrayList = new List
And if you are not able to override "MyDataClass"'s hashCode and equals methods you could write a wrapper class that handles this.