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

com.magistuarmory.util.DualKey Maven / Gradle / Ivy

The newest version!
package com.magistuarmory.util;

import java.util.Objects;

public class DualKey
{
    public K1 key1;
    public K2 key2;

    public DualKey(K1 key1, K2 key2)
    {
        this.key1 = key1;
        this.key2 = key2;
    }

    @SuppressWarnings("rawtypes")
    @Override
    public boolean equals(Object o)
    {
        if (this == o) {
            return true;
        }

        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        DualKey key = (DualKey) o;
        if (!Objects.equals(key1, key.key1)) 
        {
            return false;
        }

        return Objects.equals(key2, key.key2);
    }

    @Override
    public int hashCode()
    {
        int result = key1 != null ? key1.hashCode() : 0;
        result = 31 * result + (key2 != null ? key2.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return "[" + key1 + ", " + key2 + "]";
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy