How can i sort my arraylist alphabetical

后端 未结 2 1194
忘掉有多难
忘掉有多难 2021-01-28 20:48

I want to sort my arraylist alphabetical but I don\'t get it...maybe you can help me. I dont know why but i cant work with collections.sort...what am i coding wrong? thanks a l

相关标签:
2条回答
  • 2021-01-28 21:13

    You have to implement your own Comparator<HashMap<String,String>> and pass it to Collections.sort.

    0 讨论(0)
  • 2021-01-28 21:17

    Use Collections.sort

    Collections.sort(listOfStrings, String.CASE_INSENSITIVE_ORDER);
    

    See the following for details:

    String.CASE_INSENSITIVE_ORDER

    Collections.sort

    You can also create a custom Comparator, instead of using String.CASE_INSENSITIVE_ORDER

    0 讨论(0)
提交回复
热议问题