I have an object called FormObject that contains two ArrayLists - oldBooks and newBooks - both of which contain Book objects.
oldBooks is allowed to contain duplicate Book objects newBooks is not allowed to contain duplicate Book objects within itself and cannot include any duplicates of Book objects in the oldBooks list.
The definition of a duplicate Book is complex and I can't override the equals method as the definition is not universal across all uses of the Book object.
I plan to have a method on the FormObject class called removeDuplicateNewBooks which will perform the above functionality.
How would you go about implementing this? My first thought was to use HashSets to eliminate the duplicates but not being able to override equals on the Book object means it won't work.