Here you can find the source of hashCode(String[] names, Object[] values)
Parameter | Description |
---|---|
names | the sorted array of descriptor names. |
values | the array of descriptor values. |
public static int hashCode(String[] names, Object[] values)
//package com.java2s; /*/* www . j av a 2 s. c o m*/ * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * * * */ import java.util.Arrays; public class Main { /** * Computes a descriptor hashcode from its names and values. * @param names the sorted array of descriptor names. * @param values the array of descriptor values. * @return a hash code value, as described in {@link #hashCode(Descriptor)} */ public static int hashCode(String[] names, Object[] values) { int hash = 0; for (int i = 0; i < names.length; i++) { Object v = values[i]; int h; if (v == null) { h = 0; } else if (v instanceof Object[]) { h = Arrays.deepHashCode((Object[]) v); } else if (v.getClass().isArray()) { h = Arrays.deepHashCode(new Object[] { v }) - 31; // hashcode of a list containing just v is // v.hashCode() + 31, see List.hashCode() } else { h = v.hashCode(); } hash += names[i].toLowerCase().hashCode() ^ h; } return hash; } }