Code example for Ordering

Methods: compare

0
    } 
 
    private static Ordering<CategorizedDomainObject> ORDER_BY_CATEGORY = new Ordering<CategorizedDomainObject>() {
        @Override 
        public int compare(CategorizedDomainObject left, CategorizedDomainObject right) { 
            return Ordering.natural().nullsFirst().compare(left.getCategory(), right.getCategory()); 
        } 
    }; 
     
    private static Ordering<CategorizedDomainObject> ORDER_BY_SUBCATEGORY = new Ordering<CategorizedDomainObject>() {
        @Override 
        public int compare(CategorizedDomainObject left, CategorizedDomainObject right) { 
            return Ordering.natural().nullsFirst().compare(left.getSubcategory(), right.getSubcategory()); 
        } 
         
    }; 
 
 
 
} 
Connect your IDE to all the code out there  Get Codota for Java