How can I sort this ArrayList the way that I want?

前端 未结 12 1785
刺人心
刺人心 2020-12-04 18:17

Here is a simple sorting program of an ArrayList:

ArrayList list = new ArrayList();

list.add(\"1_Update\");
list.add(\"11_Add\")         


        
12条回答
  •  生来不讨喜
    2020-12-04 18:43

    As stated above, you are looking for a Comparator implementation that implements a natural sort. Jeff Atwood wrote an excellent post on natural sorting some time ago - it's well worth a read.

    If you're looking for a Java implementation I have found this one to be useful: http://www.davekoelle.com/alphanum.html

提交回复
热议问题