In Kotlin, Using Equals & HashCode To Remove Duplicates, How To Choose Which To Remove
I'm using Equals and HashCode to enable HashSet to automatically remove duplicates of my custom class.
When there's a duplicate, how could I define which of the duplicates is removed from the HashSet and which is to remain in the HashSet? I believe the standard behaviour is that the newer object simply isn't added to the HashSet.
Many thanks,
A