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

前端 未结 6 894
春和景丽
春和景丽 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:56

    Try this

    Comparator.comparing(Employee::getName, String.CASE_INSENSITIVE_ORDER)
    

提交回复
热议问题