jdk1.8 sort 排序

//升序
newList.sort((Record c1,Record c2)-> Double.valueOf(c1.getStr("distance")).compareTo(Double.valueOf(c2.getStr("distance"))));

//降序
newList.sort((Record c1,Record c2)-> Double.valueOf(c2.getStr("distance")).compareTo(Double.valueOf(c1.getStr("distance"))));

 

你可能感兴趣的:(java)