It seems to me that the expressions
if (obj == null || getClass() != obj.getClass()) return false;
and
if (!(obj instanceof Solution))   return false;
are equivalent. Is not it?