How to check two different classes having the same attributes in different order have the same values
public class Person {
        String name;
        Long age;
        // getters and setters
        // equals and hashcode    
}
Second class attributes in different order
public class PersonTwo {            
            Long age;
            String name;
            // getters and setters
            // equals and hashcode    
    }
Checking two objects equal
        Person person = new Person();
        person.setAge(122L);
        person.setName("Paul");
        PersonTwo person2 = new PersonTwo();
        person2.setName("Paul");
        person2.setAge(122L);
        
        boolean result = Objects.equals(person2, person);
This will return false, cannot make changes in both classes as they are from another library.
Instead of comparing each attribute value, any easy ways to do this?
 
    