TimSort 方法内部调用什么方法?
TimSort 是 Java 7 中默认使用的排序算法。
我找到了这个来源,但我不明白要调用哪个方法,因为它们都是私有的。 有人能明白吗?谢谢。
TimSort is an algorithm that will be used by default in Java 7 for sorting.
I found this source, but I don't understand which method to call since all of them are private.
Can anybody understand? Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你什么也不叫。
它具有
java.util
包私有的排序方法。当您调用 Arrays.sort() 函数或类似函数时,您可以让它调用它们。评论清楚地表明了这一点:
从我上次评论的时间来看,这花了不到 15 分钟的时间:
结果:
You don't call anything.
It has sort methods that are package private to
java.util
. You let it call them when you call theArrays.sort()
function or something like it.This is made clear by the comment:
Judging by the time of my last comment, this took less than 15 minutes to do:
And the result: