protected List < Double > rankScores ( final Map < I , Double > userItems ) { List < Double > sortedScores = new ArrayList <> ( ) ; if ( userItems == null ) { return sortedScores ; } for ( Map . Entry < I , Double > e : userItems . entrySet ( ) ) { double pref = e . getValue ( ) ; if ( Double . isNaN ( pref ) ) { // we ignore any preference assigned as NaN continue ; } sortedScores . add ( pref ) ; } Collections . sort ( sortedScores , Collections . reverseOrder ( ) ) ; return sortedScores ; }
Ranks the scores of an item - score map .