private boolean equalsWithArrayList(@NotNull ArrayList<?> that) {
    int size = mySize;
    if (size != that.size()) {
      return false;
    }
    switch (size) {
      case 0:
        return true;
      case 1:
        return Objects.equals(myElem, that.get(0));
      default:
        return that.equals(this);
    }
  }
private boolean equalsWithArrayList(@NotNull ArrayList<?> that)