Sort ArrayList of Array in Java

后端 未结 7 1092
感动是毒
感动是毒 2020-11-29 09:20

What is the best way to sort an ArrayList in Java?

Where String[] is...

String[] = new String[] { \"abc\", \"abc\", \"ab         


        
7条回答
  •  夕颜
    夕颜 (楼主)
    2020-11-29 10:12

    Based on your edit: Your String[] should be a School object to contain your attributes. Make your School object implement Comparable and that will allow easy sorting with Collections.sort().

提交回复
热议问题