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

grails.util.Pair Maven / Gradle / Ivy

There is a newer version: 6.2.0
Show newest version
package grails.util;

public class Pair {
    final A aValue;
    final B bValue;

    public Pair(A aValue, B bValue) {
        this.aValue = aValue;
        this.bValue = bValue;
    }

    public A getaValue() {
        return aValue;
    }

    public B getbValue() {
        return bValue;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((aValue == null) ? 0 : aValue.hashCode());
        result = prime * result + ((bValue == null) ? 0 : bValue.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        Pair other = (Pair)obj;
        if (aValue == null) {
            if (other.aValue != null)
                return false;
        }
        else if (!aValue.equals(other.aValue))
            return false;
        if (bValue == null) {
            if (other.bValue != null)
                return false;
        }
        else if (!bValue.equals(other.bValue))
            return false;
        return true;
    }

    @Override
    public String toString() {
        return "TupleKey [aValue=" + aValue + ", bValue=" + bValue + "]";
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy