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

com.cmeza.sdgenerator.util.Tuple Maven / Gradle / Ivy

There is a newer version: 2.0.1
Show newest version
package com.cmeza.sdgenerator.util;

/**
 * Created by carlos on 23/04/17.
 */
public class Tuple, Y extends Comparable> implements Comparable>{
    public final X x;
    public final Y y;
    public Tuple(X x, Y y) {
        this.x = x;
        this.y = y;
    }

    public X left(){
        return this.x;
    }

    public Y right(){
        return this.y;
    }

    @Override
    public String toString() {
        return "(" + x + "," + y + ")";
    }

    @Override
    public int compareTo(Tuple o) {
        int d = this.x.compareTo(o.x);
        if (d == 0)
            return this.y.compareTo(o.y);
        return d;
    }

    @Override
    public boolean equals(Object obj) {
        return super.equals(obj);
    }

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy