com.cmeza.sdgenerator.util.Tuple Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spring-data-generator Show documentation
Show all versions of spring-data-generator Show documentation
Spring Data Generator for JPA repositories and managers.
package com.cmeza.sdgenerator.util;
/**
* Created by carlos on 23/04/17.
*/
public class Tuple, Y extends Comparable super Y>> 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();
}
}