Here you can find the source of hash(Object... as)
public static int hash(Object... as)
//package com.java2s; /**/* w w w .j ava 2 s . c o m*/ * Copyright 2009, 2010 The Regents of the University of California * Licensed under the Educational Community License, Version 2.0 * (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.osedu.org/licenses/ECL-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an "AS IS" * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing * permissions and limitations under the License. * */ public class Main { /** * Create a hash code for a list of objects. Each of them may be null. * Algorithm adapted from "Programming in Scala, Second Edition", p670. */ public static int hash(Object... as) { if (as == null) return 0; int hash = 0; for (Object a : as) { if (hash != 0) hash = 41 * hash + hash1(a); else hash = 41 + hash1(a); } return hash; } private static int hash1(Object a) { return a != null ? a.hashCode() : 0; } }