@ Override public int compare ( final TagToCategory o1 , final TagToCategory o2 ) { if ( o1 == null && o2 == null ) return 0 ; if ( o1 == null ) return lessThan ; if ( o2 == null ) return greaterThan ; if ( o1 . getSorting ( ) == null && o2 . getSorting ( ) == null ) return compareSecondLevel ( o1 , o2 ) ; if ( o1 . getSorting ( ) == null ) return greaterThan ; if ( o2 . getSorting ( ) == null ) return lessThan ; if ( o1 . getSorting ( ) . equals ( o2 . getSorting ( ) ) ) return compareSecondLevel ( o1 , o2 ) ; return o1 . getSorting ( ) . compareTo ( o2 . getSorting ( ) ) * greaterThan ; }
Sorting order is preferentially used to sort TagToCategory s or the name of the Tag that the TagToCategory s point to are used if both TagToCategory s sorting orders are null .