import com.alibaba.fastjson.JSON;
import java.util.*;
import java.util.stream.Collectors;
/**
* Hello world!
*
*/
public class App {
public static void main( String[] args ) {
Map mapRepeat = new HashMap<>();
mapRepeat.put("aa", 1);
mapRepeat.put("bb", 45);
mapRepeat.put("cc", 32);
mapRepeat.put("dd", 226);
mapRepeat.put("ee", 16);
mapRepeat.put("ff", 320);
mapRepeat.put("gg", 99);
// 1.8以后 使用lambda表达式和Stream处理
// 1.对Map的value进行降序排序,并取前5个key
List mobileList = mapRepeat.entrySet().stream()
.sorted((Map.Entry e1, Map.Entry e2) -> e2.getValue() - e1.getValue())
.map(entry -> entry.getKey()).collect(Collectors.toList())
.subList(0, 5);
System.out.println(