Simple way to sort strings in the (case sensitive) alphabetical order

前端 未结 5 2017
生来不讨喜
生来不讨喜 2020-11-27 19:56

I need to sort list of strings in the alphabetical order:

List list = new ArrayList();
list.add(\"development\");
list.add(\"Development\");
li         


        
5条回答
  •  粉色の甜心
    2020-11-27 20:45

    I recently answered a similar question here. Applying the same approach to your problem would yield following solution:

    list.sort(
      p2Ord(stringOrd, stringOrd).comap(new F>() {
        public P2 f(String s) {
          return p(s.toLowerCase(), s);
        }
      })
    );
    

提交回复
热议问题