com.github.edgar615.util.vertx.function.Tuple4 Maven / Gradle / Ivy
package com.github.edgar615.util.vertx.function;
/**
* 四元组.
*/
public class Tuple4 {
private final T1 t1;
private final T2 t2;
private final T3 t3;
private final T4 t4;
private Tuple4(T1 t1, T2 t2, T3 t3, T4 t4) {
this.t1 = t1;
this.t2 = t2;
this.t3 = t3;
this.t4 = t4;
}
public static Tuple4 create(T1 t1, T2 t2, T3 t3, T4 t4) {
return new Tuple4<>(t1, t2, t3, t4);
}
public T1 getT1() {
return t1;
}
public T2 getT2() {
return t2;
}
public T3 getT3() {
return t3;
}
public T4 getT4() {
return t4;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
final Tuple4 tuple2 = (Tuple4) o;
if (t1 != null ? !t1.equals(tuple2.t1) : tuple2.t1 != null) {
return false;
}
if (t2 != null ? !t2.equals(tuple2.t2) : tuple2.t2 != null) {
return false;
}
if (t3 != null ? !t3.equals(tuple2.t3) : tuple2.t3 != null) {
return false;
}
if (t4 != null ? !t4.equals(tuple2.t4) : tuple2.t4 != null) {
return false;
}
return true;
}
@Override
public int hashCode() {
int result = t1 != null ? t1.hashCode() : 0;
result = 31 * result + (t2 != null ? t2.hashCode() : 0);
result = 31 * result + (t3 != null ? t3.hashCode() : 0);
result = 31 * result + (t4 != null ? t4.hashCode() : 0);
return result;
}
@Override
public String toString() {
return String.format("(%s, %s, %s, %s)", getT1(), getT2(), getT3(), getT4());
}
}