나는 관리 노래 목록을 가지고 있으므로 지금 노래를 분류하는 것이 나의 기준이다. 어떻게 이것을 람다 식으로 "변환"할 수 있습니까? 간단한특정 Comparator를 람다 식으로 변환하려면 어떻게해야합니까?
gestionCancionList.sort(new Comparator<GestionCancion>() {
@Override
public int compare(GestionCancion t1, GestionCancion t2){
return t1.vecesQueSeRepite == t2.vecesQueSeRepite ?
t1.song.dameInterprete().compareTo(t2.song.dameInterprete())
: (int)(t2.vecesQueSeRepite - t1.vecesQueSeRepite);
}
}
대단히 고맙습니다. 그래서 저는 하나의 방법을 사용하지 않고 동일한 방법을 사용하고 있습니다. "Comparator aName = (GestionCancion t1, GestionCancion t2) -> compare (t1, t2)" –
또한 간단한 예제를 참조로 첨부했습니다. – Raghuveer