src/language model based query topic analysis/src/edu/virginia/cs/model/LanguageModel.java
private List<Entry<String, Double>> sortByComparator(Map<String, Double> unsortMap, final boolean order) {
        List<Entry<String, Double>> list = new LinkedList<>(unsortMap.entrySet());
        // Sorting the list based on values
        Collections.sort(list, (Entry<String, Double> o1, Entry<String, Double> o2) -> {
            if (order) {
                return o1.getValue().compareTo(o2.getValue());
            } else {
                return o2.getValue().compareTo(o1.getValue());

            }
        });
        return list;
    }
/**
     * Method that generate the id of all users for evaluation.
     *
     * @param unsortMap unsorted Map
     * @param order if true, then sort in ascending order, otherwise in
     * descending order
     * @return sorted Map
     */
Method that generate the id of all users for evaluation.
@param unsortMap unsorted Map
@param order if true, then sort in ascending order, otherwise in
descending order
@return sorted Map
Method that generate the id of all users for evaluation . @param unsortMap unsorted Map @param order if true then sort in ascending order otherwise in descending order @return sorted Map
private List<Entry<String, Double>> sortByComparator(Map<String, Double> unsortMap, final boolean order) {
        List<Entry<String, Double>> list = new LinkedList<>(unsortMap.entrySet());
        Collections.sort(list, (Entry<String, Double> o1, Entry<String, Double> o2) -> {
            if (order) {
                return o1.getValue().compareTo(o2.getValue());
            } else {
                return o2.getValue().compareTo(o1.getValue());
            }
        });
        return list;
    }
private List < Entry < String , Double > > sortByComparator ( Map < String , Double > unsortMap , final boolean order ) { List < Entry < String , Double > > list = new LinkedList < > ( unsortMap . entrySet ( ) ) ; Collections . sort ( list , ( Entry < String , Double > o1 , Entry < String , Double > o2 ) -> { if ( order ) { return o1 . getValue ( ) . compareTo ( o2 . getValue ( ) ) ; } else { return o2 . getValue ( ) . compareTo ( o1 . getValue ( ) ) ; } } ) ; return list ; }
Method that generate the id of all users for evaluation.
Method that generate the id of all users for evaluation .
// Sorting the list based on values