Sorting ArrayList with Lambda in Java 8

前端 未结 11 2188
北荒
北荒 2020-12-29 18:08

Could somebody show me a quick example how to sort an ArrayList alphabetically in Java 8 using the new lambda syntax.

11条回答
  •  庸人自扰
    2020-12-29 18:58

    In functional programming, you're not using the old objects to operate on them, but creating the new one in such a fashion:

    list.stream().sorted().map(blah-blah).filter(...)...
    

提交回复
热议问题