001package gudusoft.gsqlparser.dlineage.util; 002 003public class Pair3<F, S, T> { 004 005 public final F first; 006 public final S second; 007 public final T third; 008 009 public Pair3(F v1, S v2, T v3) { 010 this.first = v1; 011 this.second = v2; 012 this.third = v3; 013 } 014 015 @Override 016 public boolean equals(Object obj) { 017 if (this == obj) return true; 018 if (!(obj instanceof Pair3)) return false; 019 Pair3<?, ?, ?> other = (Pair3<?, ?, ?>) obj; 020 return Objects.equal(first, other.first) && 021 Objects.equal(second, other.second) && 022 Objects.equal(third, other.third); 023 } 024 025 @Override 026 public int hashCode() { 027 int h1 = first != null ? first.hashCode() : 0; 028 int h2 = second != null ? second.hashCode() : 0; 029 int h3 = third != null ? third.hashCode() : 0; 030 return (h1 ^ h2) ^ h3; 031 } 032 033 public static <A, B, C> Pair3<A, B, C> create(A v1, B v2, C v3) { 034 return new Pair3<>(v1, v2, v3); 035 } 036 037 @Override 038 public String toString() { 039 return third != null ? "[" + first + "," + second + "," + third + "]" 040 : "[" + first + "," + second + "]"; 041 } 042}