More efficient sort algorithm?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I'm looking for an algorithm, which could perform better, than Arrays.sort() . I know this will look like a silly question asked million times, but please read on. Let's have two classes implementing Comparable whose natural ordering is based on an int value. The first compareTo method looks like this: public int compareTo ( ComparableInteger o ) { return this . value - o . value ; } The second is this: public int compareTo ( ComparableInteger o ) { if ( this . value > o . value ) { return 1 ; } else { if ( this . value == o .