All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.maxifier.mxcache.hashing.ArrayHashingStrategy 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 ArrayHashingStrategy implements gnu.trove.strategy.HashingStrategy {
    private static final long serialVersionUID = 100L;

    private static final ArrayHashingStrategy INSTANCE = new ArrayHashingStrategy();

    private ArrayHashingStrategy() {}

    @SuppressWarnings({"unchecked"})
    public static  ArrayHashingStrategy getInstance() {
        return INSTANCE;
    }

    @Override
    public int computeHashCode(T[] object) {
        return Arrays.deepHashCode(object);
    }

    @Override
    public boolean equals(T[] o1, T[] o2) {
        return Arrays.deepEquals(o1, o2);
    }

    private Object readResolve() throws ObjectStreamException {
        return INSTANCE;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy