public int compareTo(Contents that) { if (_name.compareTo(that.name()) > 0) { return 1; } if (_name.compareTo(that.name()) < 0) { return -1; } if (_build.compareTo(that.build()) > 0) { return 1; } if (_build.compareTo(that.build()) < 0) { return -1; } if (_specs.compareTo(that.specs()) > 0) { return 1; } if (_specs.compareTo(that.specs()) < 0) { return -1; } if (cost() - that.cost() != 0) { return cost() - that.cost(); } return 0; }