Java Set collection - override equals method
Is there any way to override the the equals method used by a Set datatype? I wrote a custom equals method for a class called Fee . Now I have a LnkedList of Fee and I want to ensure that there are no duplicated entries. Thus I am considering using a Set insted of a LinkedList , but the criteria for deciding if two fees are equal resides in the overriden equals method in the Fee class. If using a LinkedList , I will have to iterate over every list item and call the overriden equals method in the Fee class with the remaining entries as a parameter. Just reading this alone sounds like too much