Java Hash Calculate hash(int seed, int i)

Here you can find the source of hash(int seed, int i)

Description

hash

License

Open Source License

Declaration

public static int hash(int seed, int i) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2005, 2006 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors://from  w  w w . ja v a 2 s  .c om
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

public class Main {
    public static int SEED = 11;
    private static int MULTI = 31;

    public static int hash(int seed, int i) {
        return seed * MULTI + i;
    }

    public static int hash(int seed, Object obj) {
        return hash(seed, null != obj ? obj.hashCode() : SEED);
    }

    public static int hash(int seed, boolean b) {
        return hash(seed, b ? 1 : SEED);
    }
}

Related

  1. hash(int k)
  2. hash(int key)
  3. hash(int n)
  4. hash(int p_188208_0_)
  5. hash(int seed, boolean value)
  6. hash(int seed, int toHash)
  7. hash(int seed, int val)
  8. hash(int state1, int state2, int numStates1)
  9. hash(int val)