Пример #1
0
    @Override
    public boolean equals(Object o) {
      if (this == o) return true;
      if (o == null || getClass() != o.getClass()) return false;

      Pair<?, ?> pair = (Pair<?, ?>) o;

      if (x != null ? !x.equals(pair.x) : pair.x != null) return false;
      return !(y != null ? !y.equals(pair.y) : pair.y != null);
    }
Пример #2
0
 @Override
 public int hashCode() {
   int result = x != null ? x.hashCode() : 0;
   result = 31 * result + (y != null ? y.hashCode() : 0);
   return result;
 }