Nice general way to sort nulls to the bottom, regardless?

后端 未结 5 551
北恋
北恋 2021-01-02 10:53

I\'m writing some custom Comparators, and I\'d like them to push null items to the bottom of the list, regardless of whether I\'m sorting ascending or descending. What\'s a

5条回答
  •  天命终不由人
    2021-01-02 11:45

    You could always use NullComparator from commons-collections. It's been around longer than Google Collections.

提交回复
热议问题