com.sap.it.commons.data.Triple Maven / Gradle / Ivy
package com.sap.it.commons.data;
import java.io.Serializable;
import com.sap.it.commons.lang.Equals;
import com.sap.it.commons.lang.Hash;
public class Triple implements Serializable {
private static final long serialVersionUID = 8719382431393826469L;
private final T first;
private final U second;
private final V third;
public Triple(T a, U b, V c) {
first = a;
second = b;
third = c;
}
public T getFirst() {
return first;
}
public U getSecond() {
return second;
}
public V getThird() {
return third;
}
@Override
public int hashCode() {
return Hash.hash(first, second, third);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof Triple)) {
return false;
}
@SuppressWarnings("unchecked")
Triple other = (Triple) obj;
return Equals.equals(first, other.first) && //
Equals.equals(second, other.second) && //
Equals.equals(third, other.third);
}
@Override
public String toString() {
return "[" + first + ", " + second + ", " + third + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
public static Triple create(T a, U b, V c) {
return new Triple(a, b, c);
}
@SuppressWarnings("unchecked")
public static final Triple nullTriple() {
return (Triple) NULL_TRIPLE;
}
@SuppressWarnings("rawtypes")
public static final Triple NULL_TRIPLE = new Triple
© 2015 - 2025 Weber Informatics LLC | Privacy Policy