Repository: microsoft/gctoolkit
File: api/src/main/java/com/microsoft/gctoolkit/time/DateTimeStamp.java (Java)

Code before:

    @Override
    public boolean equals(Object obj) {
        if (obj instanceof DateTimeStamp) {
            DateTimeStamp other = (DateTimeStamp) obj;
            if (this.hasDateStamp())
                return this.getDateTime().equals(other.getDateTime()) &&
                        (this.getTimeStamp() == other.getTimeStamp());
            else
                return getTimeStamp() == other.getTimeStamp();
        }
        return false;
    }

    @Override
    public int hashCode() {
        return Objects.hash(getDateTime(), getTimeStamp());
    }

    @Override
    public String toString() {
        StringBuilder buffer = new StringBuilder();
        if (hasDateStamp())
            buffer.append(getDateTime().toString());
        if (hasTimeStamp())
            buffer.append("@").append(String.format(Locale.US,"%.3f",getTimeStamp()));
        return buffer.toString();
    }

    /**
     * Return {@code true} if this DateTimeStamp comes before the other.
     * @param other The other DateTimeStamp.
     * @return {@code true} if this time stamp is less than the other.
     */
    public boolean before(DateTimeStamp other) {
        return getTimeStamp() < other.getTimeStamp();
    }

    /**
     * Return {@code true} if this DateTimeStamp comes after the other.
     * @param other The other DateTimeStamp.
     * @return {@code true} if this time stamp is less than the other.
     */
    public boolean after(DateTimeStamp other) {
        return getTimeStamp() > other.getTimeStamp();
    }

    /**
     * Return {@code 1} if this date is after than the other,
     * {@code -1} if this date is before the other,
     * or {@code 0} if this date is the same as the other.

Review comment (suggestion):
```suggestion
            buffer.append("@").append(String.format(Locale.US,"%.3f", getTimeStamp()));
```

Code after:

    @Override
    public boolean equals(Object obj) {
        if (obj instanceof DateTimeStamp) {
            DateTimeStamp other = (DateTimeStamp) obj;
            if (this.hasDateStamp())
                return this.getDateTime().equals(other.getDateTime()) &&
                        (this.getTimeStamp() == other.getTimeStamp());
            else
                return getTimeStamp() == other.getTimeStamp();
        }
        return false;
    }

    @Override
    public int hashCode() {
        return Objects.hash(getDateTime(), getTimeStamp());
    }

    @Override
    public String toString() {
        StringBuilder buffer = new StringBuilder();
        if (hasDateStamp())
            buffer.append(getDateTime().toString());
        if (hasTimeStamp())
            buffer.append("@").append(String.format(Locale.US,"%.3f", getTimeStamp()));
        return buffer.toString();
    }

    /**
     * Return {@code true} if this DateTimeStamp comes before the other.
     * @param other The other DateTimeStamp.
     * @return {@code true} if this time stamp is less than the other.
     */
    public boolean before(DateTimeStamp other) {
        return compareTo(other) < 0;
    }

    /**
     * Return {@code true} if this DateTimeStamp comes after the other.
     * @param other The other DateTimeStamp.
     * @return {@code true} if this time stamp is less than the other.
     */
    public boolean after(DateTimeStamp other) {
        return compareTo(other) > 0;
    }

    /**
     * Return {@code 1} if this date is after than the other,
     * {@code -1} if this date is before the other,
     * or {@code 0} if this date is the same as the other.