This is a pretty common question, but I could not find this part:
Say I have this array list:
List arrayList = new List
please see this article that explains the importance of equals() and hashCode to HashSets
equals()
hashCode
HashSets
Also, see this previously answered question