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

scouter.util.Pair Maven / Gradle / Ivy

There is a newer version: 2.20.0
Show newest version
package scouter.util;

/**
 * @author Gun Lee ([email protected]) on 2016. 1. 26.
 * origin : http://stackoverflow.com/questions/521171/a-java-collection-of-value-pairs-tuples
 */
public class Pair {
    private final L left;
    private final R right;

    public Pair(L left, R right) {
        this.left = left;
        this.right = right;
    }

    public L getLeft() { return left; }
    public R getRight() { return right; }

    @Override
    public int hashCode() { return left.hashCode() ^ right.hashCode(); }

    @Override
    public boolean equals(Object o) {
        if (!(o instanceof Pair)) return false;
        Pair pairo = (Pair) o;
        return this.left.equals(pairo.getLeft()) &&
                this.right.equals(pairo.getRight());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy