Пример #1
0
 public void removeElement(X element) {
   int cont = 0;
   for (X e : neighbors) {
     if (e.equals(element) == true) {
       this.neighbors.remove(cont);
       return;
     } else cont++;
   }
 }
Пример #2
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);
    }