為什麼Java缺少sortedList
的原因
缺乏從列表it iTererator的基礎性質的sortedList詞幹。列出迭代器優先保留元素的插入順序。 Sorting, on the other hand, can be viewed as a manipulation of the data structure, altering the element order.Alternatives to SortedList
SortedSet and Multisets (Bags):
接受定制排序的比較器,例如,允許區域敏感的字符串排序。 PriorityQueue provides a sorted queue behavior suitable for certain use cases.
Iteration through a PriorityQueue returns elements in sorted order.Users can create their own SortedList by extending the AbstractList class and覆蓋添加和排序方法。 此選項不建議使用,因為它違反了列表接口合同,並且對現有解決方案沒有明顯的優勢。 [&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& && && && &&&華
免責聲明: 提供的所有資源部分來自互聯網,如果有侵犯您的版權或其他權益,請說明詳細緣由並提供版權或權益證明然後發到郵箱:[email protected] 我們會在第一時間內為您處理。
Copyright© 2022 湘ICP备2022001581号-3