I have two objects as Employee and Person. Both of them have firstName and lastName. I don't want to add object(either Employee or Person) to the list if firstName,lastName for either Person and Employee has already been added to the list.
Use equals and hashcode to do this...
Edit:I cannot use Set or any other collection, and have to use equals and hashcode to achieve this.