Sorting a LinkedHashSet

后端 未结 4 1691
旧巷少年郎
旧巷少年郎 2020-12-20 11:24

I\'m wondering if it\'s possible to sort a LinkedHashSet. I\'ve tried the statement

Collections.sort((List paragraph);

Howeve

4条回答
  •  天涯浪人
    2020-12-20 12:04

    Collections.sort does not work on Sets, only on Lists. If you need to sort the data that is already in a Set, you might want to first add them into a List.

提交回复
热议问题