Quantcast
Channel: How to sort List of objects by some property - Stack Overflow
Viewing all articles
Browse latest Browse all 19

Answer by 卢声远 Shengyuan Lu for How to sort List of objects by some property

$
0
0

Guava's ComparisonChain:

Collections.sort(list, new Comparator<ActiveAlarm>(){            @Override            public int compare(ActiveAlarm a1, ActiveAlarm a2) {                 return ComparisonChain.start()                       .compare(a1.timestarted, a2.timestarted)                       //...                       .compare(a1.timeEnded, a1.timeEnded).result();            }});

Viewing all articles
Browse latest Browse all 19

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>