private List < Entry > sortEntries ( List < Entry > loadedEntries ) { Collections . sort ( loadedEntries , new Comparator < Entry > ( ) { @ Override public int compare ( Entry entry1 , Entry entry2 ) { int result = ( int ) ( entry1 . cuePosition - entry2 . cuePosition ) ; if ( result == 0 ) { int h1 = ( entry1 . hotCueNumber != 0 ) ? 1 : 0 ; int h2 = ( entry2 . hotCueNumber != 0 ) ? 1 : 0 ; result = h1 - h2 ; } return result ; } } ) ; return Collections . unmodifiableList ( loadedEntries ) ; }
Sorts the entries into the order we want to present them in which is by position with hot cues coming after ordinary memory points if both exist at the same position which often happens .