How can I sort an ArrayList of Strings in Java?

后端 未结 5 1102
遥遥无期
遥遥无期 2020-11-30 09:21

I have Strings that are put into an ArrayList randomly.

private ArrayList teamsName = new ArrayList();
         


        
5条回答
  •  旧巷少年郎
    2020-11-30 10:03

    Collections.sort(teamsName.subList(1, teamsName.size()));
    

    The code above will reflect the actual sublist of your original list sorted.

提交回复
热议问题