Java Hash Calculate hash(int i, int j)

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

Description

Combines two integers into a hash code.

License

Open Source License

Declaration

public static int hash(int i, int j) 

Method Source Code

//package com.java2s;
/*//  w w  w  .java2  s .  c  o  m
 // This software is subject to the terms of the Eclipse Public License v1.0
 // Agreement, available at the following URL:
 // http://www.eclipse.org/legal/epl-v10.html.
 // You must accept the terms of that agreement to use this software.
 //
 // Copyright (C) 2001-2005 Julian Hyde
 // Copyright (C) 2005-2012 Pentaho and others
 // All Rights Reserved.
 */

public class Main {
    /**
     * Combines two integers into a hash code.
     */
    public static int hash(int i, int j) {
        return (i << 4) ^ j;
    }

    /**
     * Computes a hash code from an existing hash code and an object (which
     * may be null).
     */
    public static int hash(int h, Object o) {
        int k = (o == null) ? 0 : o.hashCode();
        return ((h << 4) | h) ^ k;
    }
}

Related

  1. hash(int h)
  2. hash(int h)
  3. hash(int h, boolean v)
  4. hash(int h, Object o)
  5. hash(int hash, boolean item)
  6. hash(int k)
  7. hash(int k)
  8. hash(int key)
  9. hash(int n)