class Index {

  public final int value;

  /**
   * Creates a new {@link Index}.
   *
   * @param value the value of the index.
   * @return the created {@code Index}.
   * @throws IllegalArgumentException if the given value is negative.
   */
  public static Index atIndex(int value) {
    checkArgument(value >= 0, "The value of the index should not be negative");
    return new Index(value);
  }

  private Index(int value) {
    this.value = value;
  }

  @Override
  public boolean equals(Object obj) {<FILL_FUNCTION_BODY>}

  @Override
  public int hashCode() {
    return Integer.hashCode(value);
  }

  @Override
  public String toString() {
    return String.format("%s[value=%d]", getClass().getSimpleName(), value);
  }

}

    if (this == obj) return true;
    if (!(obj instanceof Index)) return false;
    Index other = (Index) obj;
    return value == other.value;
  
<no_super_class>