方法hashCode(int [] a)在Java中做什么?
java.util.Arrays类的 hashCode(int[])方法基于指定数组的内容返回哈希码。对于任意两个非空int数组a和b,例如Arrays.equals(a,b),Arrays.hashCode(a)==Arrays.hashCode(b)也是这种情况。
示例
import java.util.Arrays;
public class ArrayDemo {
public static void main(String[] args) {
int[] ival = new int[] { 3, 5 };
int retval = ival.hashCode();
System.out.println("The hash code of value1 is: " + retval);
ival = new int[] { 19, 75 };
retval = ival.hashCode();
System.out.println("The hash code of value2 is: " + retval);
}
}输出结果
The hash code of value1 is: 4072869 The hash code of value2 is: 1671711
热门推荐
10 歌词祝福语高级文案简短
11 高考给舍友祝福语简短
12 宝宝新年祝福语大全简短
13 小年好的祝福语简短
14 要过年了祝福语简短
15 感动妈妈的祝福语简短
16 新年祝福语简短句子
17 祝福语女友文案简短霸气
18 项目总生日祝福语简短