Example usage for com.google.common.primitives Longs hashCode

List of usage examples for com.google.common.primitives Longs hashCode

Introduction

In this page you can find the example usage for com.google.common.primitives Longs hashCode.

Prototype

public static int hashCode(long value) 

Source Link

Document

Returns a hash code for value ; equal to the result of invoking ((Long) value).hashCode() .

Usage

From source file:org.gpfvic.mahout.cf.taste.hadoop.TasteHadoopUtils.java

/**
 * Maps a long to an int with range of 0 to Integer.MAX_VALUE-1
 *//*from   ww  w. j a v a  2 s  .c om*/
public static int idToIndex(long id) {
    return 0x7FFFFFFF & Longs.hashCode(id) % 0x7FFFFFFE;
}

From source file:net.ufida.info.util.TasteHadoopUtils.java

/**
 * Maps a long to an int
 */
public static int idToIndex(long id) {
    return 0x7FFFFFFF & Longs.hashCode(id);
}

From source file:com.complexible.clearbit.GoogleRank.java

/**
 * @{inheritDoc}
 */
@Override
public int hashCode() {
    return Longs.hashCode(mRank);
}

From source file:com.github.fge.jsonschema.core.tree.key.AnonymousSchemaKey.java

@Override
public int hashCode() {
    return Longs.hashCode(id);
}

From source file:net.myrrix.common.SimpleRecommendedItem.java

@Override
public int hashCode() {
    return Longs.hashCode(itemID) ^ Floats.hashCode(value);
}

From source file:org.apache.cassandra.dht.LongToken.java

public int hashCode() {
    return Longs.hashCode(token);
}

From source file:com.b2international.collections.longs.LongKeyLongMapWrapper.java

@Override
public int hashCode() {
    int h = 0;//from ww  w  . ja va 2s.co m
    final LongIterator i = keySet().iterator();
    while (i.hasNext()) {
        long key = i.next();
        long value = get(key);
        h += Longs.hashCode(key) ^ Longs.hashCode(value);
    }
    return h;
}

From source file:org.apache.mahout.common.RandomUtils.java

/** @return what {@link Double#hashCode()} would return for the same value */
public static int hashDouble(double value) {
    return Longs.hashCode(Double.doubleToLongBits(value));
}

From source file:com.b2international.collections.longs.LongKeyMapWrapper.java

@Override
public int hashCode() {
    int h = 0;//from   w w w  .j  a  v  a  2 s  . co m
    final LongIterator i = keySet().iterator();
    while (i.hasNext()) {
        long key = i.next();
        V value = get(key);
        h += Longs.hashCode(key) ^ (value == null ? 0 : value.hashCode());
    }
    return h;
}

From source file:com.b2international.collections.longs.LongKeyIntMapWrapper.java

@Override
public int hashCode() {
    int h = 0;/*from w  ww  .ja v a2s .  co  m*/
    final LongIterator i = keySet().iterator();
    while (i.hasNext()) {
        long key = i.next();
        int value = get(key);
        h += Longs.hashCode(key) ^ value;
    }
    return h;
}