Java Hash Calculate hash(int h, boolean v)

Here you can find the source of hash(int h, boolean v)

Description

hash

License

Apache License

Declaration

public static int hash(int h, boolean v) 

Method Source Code

//package com.java2s;
/*//from   www  .  ja v  a  2  s  . c o m
// Licensed to Julian Hyde under one or more contributor license
// agreements. See the NOTICE file distributed with this work for
// additional information regarding copyright ownership.
//
// Julian Hyde licenses this file to you under the Apache 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.apache.org/licenses/LICENSE-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 {
    public static int hash(int h, boolean v) {
        return h * 37 + (v ? 2 : 1);
    }

    public static int hash(int h, byte v) {
        return h * 37 + v;
    }

    public static int hash(int h, char v) {
        return h * 37 + v;
    }

    public static int hash(int h, short v) {
        return h * 37 + v;
    }

    public static int hash(int h, int v) {
        return h * 37 + v;
    }

    public static int hash(int h, long v) {
        return h * 37 + (int) (v ^ (v >>> 32));
    }

    public static int hash(int h, float v) {
        return hash(h, Float.floatToIntBits(v));
    }

    public static int hash(int h, double v) {
        return hash(h, Double.doubleToLongBits(v));
    }

    public static int hash(int h, Object v) {
        return h * 37 + (v == null ? 1 : v.hashCode());
    }
}

Related

  1. hash(int aSeed, boolean aBoolean)
  2. hash(int aSeed, Object[] aArray)
  3. hash(int base, boolean field)
  4. hash(int h)
  5. hash(int h)
  6. hash(int h, Object o)
  7. hash(int hash, boolean item)
  8. hash(int i, int j)
  9. hash(int k)