How to remove duplicate object from ArrayList, but only if one specific value from object repeats with another object?
For example: I have class named Person with fields:
private String city;
private String firstName;
private String lastName;
private Long magicNumber;
I want to remove "older" Person with same "magicNumber" as the new One and keep him in ArrayList.