/*
 * @author Ranides Atterwim <ranides@gmail.com>
 * @copyright Ranides Atterwim
 * @license WTFPL
 * @url http://ranides.net/projects/assira
 */
package net.ranides.assira.collection;

import java.io.Serializable;

/**
 *
 * @author Ranides Atterwim <ranides@gmail.com>
 */
public interface HashIntComparator extends HashComparator<Integer>, IntComparator, Serializable {

    int hashCode(int object);
        
    @Override
    default int hashCode(Integer object) {
        return hashCode(object.intValue());
    }
    
    @Override
    default boolean equals(Integer a, Integer b) {
        return 0 == compare(a, b);
    }
    
    @Override
    default HashIntComparator reversed() {
        HashIntComparator that = this;
        return new HashIntComparator() {
            @Override
            public int compare(int a, int b) {
                return that.compare(b, a);
            }

            @Override
            public int hashCode(int object) {
                return that.hashCode(object);
            }

        };
    }
    
}
