Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想知道使用整理器有意义的情况(现在我们不要成为纯粹主义者)。javadocs 中的Performing Locale-Independent Comparisons页提供了一种这样的情况。我很好奇是否还有更多这样的案例。
我怀疑还有很多其他情况,但我可以想象一些:
基本上,Collator 是一个更复杂的 Comparator,所以在任何你可能使用 Comparator 的地方,理论上你都可以使用 Collator。它更适合字符串,它假设直观形式(字符串)在比较之前需要一些规范化(CollationKey)。除此之外,它几乎只有一个用例。