Comparing a string that can hold a numeric value
this.getNo() - that.getNo()


may violate the contract of compareTo() if the subtraction overflows or underflows which is a likely event if the compared values are integer IDs of a large set of elements.

Instead you should explicitly compare the two:

return Integer.compare(this.getNo(), that.getNo());


Another way to avoid numerical comparison altogether is to format numbers as fixed-width strings with a DecimalFormat and compare the resulting strings (including some example code at the end):

import java.text.DecimalFormat;

public class SomeItem implements Comparable&lt;SomeItem&gt; {

    private static final DecimalFormat fmt = new DecimalFormat();

    static {
        int len = 19; // = String.valueOf(Long.MAX_VALUE).length();
        fmt.setMinimumIntegerDigits(len);
        fmt.setMaximumIntegerDigits(len);
        fmt.setPositivePrefix("+");
        fmt.setGroupingUsed(false);
    }

    private String id;

    public SomeItem(String id) {
        this.id = id;
    }

    public SomeItem(int no) {
        this(fmt.format(no));
    }

    public String getId() {
        return id;
    }

    public int getNo() {
        return Integer.parseInt(id);
    }

    @Override
    public int compareTo(SomeItem that) {
        return this.getId().compareTo(that.getId());
    }

    public static void main(String[] args)
    {
        java.io.PrintStream o = System.out;

        SomeItem[] items = new SomeItem[] {
            new SomeItem(1),
            new SomeItem(-1),
            new SomeItem(Integer.MAX_VALUE),
            new SomeItem(Integer.MIN_VALUE)
        };

        for (SomeItem i: items)
            System.out.format("id=%s, no=%+020d%n", i.getId(), i.getNo());
    }
}


Additionally, I based the amount of digits on long instead of int to provide room for (future) growth. I would have replaced the latter by the former entirely if Java converted the return value of #getNo() silently from long to int.