为什么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