私は OpenJDK のソースを研究しています。
私の注意は、メソッドByte.compare()
とInteger.compare()
:
public static int Byte.compare(byte x, byte y) {
return x-y;
}
public static int Integer.compare(int x, int y) {
return (x < y) ? -1 : ((x == y) ? 0 : 1);
}
Byte.compare()
メソッドとメソッドのInteger.compare()
実装が異なるのはなぜですか?