@Override
  public boolean equals(Object obj) {
    if (!(obj instanceof Pair<?, ?>)) {
      return false;
    }
    Pair<?, ?> otherPair = (Pair<?, ?>) obj;
    return isEqualOrNulls(first, otherPair.getFirst())
        && isEqualOrNulls(second, otherPair.getSecond());
  }