replace Objects.equals with inlined code