cdafsd
2020-03-24 17:55:15 +08:00
class Data implements Serializable {
public boolean contantsAll(Data anotherData) {
boolean r = false;
// ... logic
return r;
}
// ...
}
class Person {
private Data memoryData;
// ...
}
static class BlackTool {
public static Data getPersonMemery(Person person) {
Data personData = null;
// ... black magic
return personData;
}
}
public class I extends Person {
public boolean thinkPersonEquals(Person foo, Person bar) {
if (Objects.equals(foo, bar)) {
return true;
}
Data fooMemory = BlackTool.getPersonMemery(foo);
Data barMemory = BlackTool.getPersonMemery(bar);
if (Objects.equals(fooMemory, barMemory)) {
return true;
}
if (Objects.isNull(fooMemory) || Objects.isNull(barMemory)) {
return false;
}
return fooMemory.contantsAll(barMemory) || barMemory.contantsAll(fooMemory);
}
}