kodejava-commons/src/main/java/org/kodejava/example/commons/lang/Fruit.java
public int compareTo(Fruit fruit) {
        return new CompareToBuilder()
            .append(this.name, fruit.name)
            .append(this.colour, fruit.colour)
            .toComparison();
    }
/*
     * Generating compareTo() method using CompareToBuilder class. For other
     * alternative way we can also use the CompareToBuilder.reflectionCompare()
     * method to implement the compareTo() method.
     */
Generating compareTo() method using CompareToBuilder class. For other
alternative way we can also use the CompareToBuilder.reflectionCompare()
method to implement the compareTo() method.
Generating compareTo () method using CompareToBuilder class . For other alternative way we can also use the CompareToBuilder . reflectionCompare () method to implement the compareTo () method .
public int compareTo(Fruit fruit) {
        return new CompareToBuilder()
            .append(this.name, fruit.name)
            .append(this.colour, fruit.colour)
            .toComparison();
    }
public int compareTo ( Fruit fruit ) { return new CompareToBuilder ( ) . append ( this . name , fruit . name ) . append ( this . colour , fruit . colour ) . toComparison ( ) ; }
Generating compareTo() method using CompareToBuilder class.
Generating compareTo () method using CompareToBuilder class .