com.maxifier.mxcache.hashing.ByteArrayHashingStrategy Maven / Gradle / Ivy
/*
* Copyright (c) 2008-2014 Maxifier Ltd. All Rights Reserved.
*/
package com.maxifier.mxcache.hashing;
import java.io.ObjectStreamException;
import java.util.Arrays;
/**
* @author Alexander Kochurov ([email protected])
*/
public final class ByteArrayHashingStrategy implements gnu.trove.strategy.HashingStrategy {
private static final long serialVersionUID = 100L;
private static final ByteArrayHashingStrategy INSTANCE = new ByteArrayHashingStrategy();
private ByteArrayHashingStrategy() {}
public static ByteArrayHashingStrategy getInstance() {
return INSTANCE;
}
@Override
public int computeHashCode(byte[] object) {
return Arrays.hashCode(object);
}
@Override
public boolean equals(byte[] o1, byte[] o2) {
return Arrays.equals(o1, o2);
}
private Object readResolve() throws ObjectStreamException {
return INSTANCE;
}
}