@Override public boolean equals(final Object obj) { if (this == obj) return true; if (!(obj instanceof TeachersOfSchoolMatch)) { // this should be infrequent if (obj == null) return false; if (!(obj instanceof IPatternMatch)) return false; IPatternMatch otherSig = (IPatternMatch) obj; if (!pattern().equals(otherSig.pattern())) return false; return Arrays.deepEquals(toArray(), otherSig.toArray()); } TeachersOfSchoolMatch other = (TeachersOfSchoolMatch) obj; if (fT == null) { if (other.fT != null) return false; } else if (!fT.equals(other.fT)) return false; if (fSch == null) { if (other.fSch != null) return false; } else if (!fSch.equals(other.fSch)) return false; return true; }