@@ -0,0 +1,2281 @@
+package mho.haskellesque.tuples;%0A%0Aimport mho.haskellesque.ordering.Ordering;%0Aimport org.jetbrains.annotations.NotNull;%0Aimport org.jetbrains.annotations.Nullable;%0A%0Aimport java.util.Comparator;%0A%0Apublic final class Triple%3CA, B, C%3E %7B%0A    public final @Nullable A a;%0A    public final @Nullable B b;%0A    public final @Nullable C c;%0A%0A    private Triple(@Nullable A a, @Nullable B b, @Nullable C c) %7B%0A        this.a = a;%0A        this.b = b;%0A        this.c = c;%0A    %7D%0A%0A    private static %3C%0A                A extends Comparable%3CA%3E,%0A                B extends Comparable%3CB%3E,%0A                C extends Comparable%3CC%3E%0A            %3E int compare(@NotNull Triple%3CA, B, C%3E p, @NotNull Triple%3CA, B, C%3E q) %7B%0A        Ordering aOrdering = Ordering.compareNullable(p.a, q.a);%0A        if (aOrdering != Ordering.EQ) return aOrdering.toInt();%0A        Ordering bOrdering = Ordering.compareNullable(p.b, q.b);%0A        if (bOrdering != Ordering.EQ) return bOrdering.toInt();%0A        return Ordering.compareNullable(p.c, q.c).toInt();%0A    %7D%0A%0A    @Override%0A    public boolean equals(Object o) %7B%0A        if (this == o) return true;%0A        if (o == null %7C%7C getClass() != o.getClass()) return false;%0A        Triple triple = (Triple) o;%0A        if (a != null ? !a.equals(triple.a) : triple.a != null) return false;%0A        if (b != null ? !b.equals(triple.b) : triple.b != null) return false;%0A        if (c != null ? !c.equals(triple.c) : triple.c != null) return false;%0A        return true;%0A    %7D%0A%0A    @Override%0A    public int hashCode() %7B%0A        int result = a != null ? a.hashCode() : 0;%0A        result = 31 * result + (b != null ? b.hashCode() : 0);%0A        result = 31 * result + (c != null ? c.hashCode() : 0);%0A        return result;%0A    %7D%0A%0A    public String toString() %7B%0A        return %22(%22 + a + %22, %22 + b + %22, %22 + c + %22)%22;%0A    %7D%0A%0A    public static class TripleComparator%3C%0A                A extends Comparable%3CA%3E,%0A                B extends Comparable%3CB%3E,%0A                C extends Comparable%3CC%3E%0A            %3E implements Comparator%3CTriple%3CA, B, C%3E%3E %7B%0A        @Override%0A        public int compare(@NotNull Triple%3CA, B, C%3E p, @NotNull Triple%3CA, B, C%3E q) %7B%0A            return Triple.compare(p, q);%0A        %7D%0A%0A        @Override%0A        public boolean equals(Object o) %7B%0A            return false;%0A        %7D%0A    %7D%0A%7D%0A

add Triple