I'm trying to implement this:
public boolean equals(Object o) {
    if (o == this) {
        return true;
    }
    if ((null == o) || !(o instanceof Document)) {
        return false;
    }
    Document other = (Document) o;
    // compare in a null-safe manner
    if (list == null) {
        if (other.list != null)
            return false;
    } else if (other.list == null)
        return false;
    else if (!(list.size() == other.list.size())
            && !(list.equals(other.list)))
        return false;
    return true;
where 'list' is a class variable as well as a field of the object 'o'. Please note that the object 'o' has many other fields including booleans and collection too and I need to compare all of them. I tried finding related answers but most of them recommend switch cases or other Java 8 components which is not relevant to my scenario.
 
     
    