Sorting string value in a case-insensitive manner in Java 8

前端 未结 6 918
春和景丽
春和景丽 2021-01-01 08:57

How do I sort string values in case-insensitive order in the following?

List listofEmployees = Arrays.asList(
    new Employee(1, \"aaa\", Ar         


        
6条回答
  •  清酒与你
    2021-01-01 09:48

    It looks like there is a Comparator that orders String objects as by compareToIgnoreCase, you can read the documentation here: https://docs.oracle.com/javase/8/docs/api/java/lang/String.html#CASE_INSENSITIVE_ORDER

提交回复
热议问题