private void sortGrantsByStartTime ( List < ResourceGrant > grants ) { Collections . sort ( grants , new Comparator < ResourceGrant > ( ) { @ Override public int compare ( ResourceGrant g1 , ResourceGrant g2 ) { if ( g1 . grantedTime < g2 . grantedTime ) { return 1 ; } if ( g1 . grantedTime > g2 . grantedTime ) { return - 1 ; } return g2 . id - g1 . id ; } } ) ; }
Sort grants on granted time in descending order