private void sortArrayList ( List < InvPair > v ) { Collections . sort ( v , new Comparator < InvPair > ( ) { @ Override public int compare ( InvPair o1 , InvPair o2 ) { if ( o1 . getCurr ( ) > o2 . getCurr ( ) ) return + 1 ; if ( o1 . getCurr ( ) < o2 . getCurr ( ) ) return - 1 ; return 0 ; } } ) ; Collections . sort ( v , new Comparator < InvPair > ( ) { @ Override public int compare ( InvPair o1 , InvPair o2 ) { if ( o1 . getLast ( ) > o2 . getLast ( ) ) return + 1 ; if ( o1 . getLast ( ) < o2 . getLast ( ) ) return - 1 ; return 0 ; } } ) ; }
Sorts the vector according to the current invariance corresponds to step 3