com.google.common.hash
Class HashCodes

java.lang.Object
  extended by com.google.common.hash.HashCodes

@Beta
public final class HashCodes
extends Object

Static factories for creating HashCode instances; most users should never have to use this. All returned instances are Serializable.

Since:
12.0
Author:
Dimitris Andreou

Method Summary
static HashCode fromBytes(byte[] bytes)
          Creates a HashCode from a byte array.
static HashCode fromInt(int hash)
          Creates a 32-bit HashCode, of which the bytes will form the passed int, interpreted in little endian order.
static HashCode fromLong(long hash)
          Creates a 64-bit HashCode, of which the bytes will form the passed long, interpreted in little endian order.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

fromInt

public static HashCode fromInt(int hash)
Creates a 32-bit HashCode, of which the bytes will form the passed int, interpreted in little endian order.


fromLong

public static HashCode fromLong(long hash)
Creates a 64-bit HashCode, of which the bytes will form the passed long, interpreted in little endian order.


fromBytes

public static HashCode fromBytes(byte[] bytes)
Creates a HashCode from a byte array. The array is defensively copied to preserve the immutability contract of HashCode. The array must be at least of length 4.



Copyright © 2010-2012. All Rights Reserved.