package com.conveyal.r5.util;

import javafx.beans.NamedArg;
import javafx.util.Pair;

/**
 * Tuple of two elements with same type
 */
public class P2<E> {
    public final E a;

    public final E b;

    /**
     * Creates a new pair
     *
     * @param b   The key for this pair
     * @param b The value to use for this pair
     */
    public P2(
        E a,
        E b) {
        this.a = a;
        this.b = b;
    }

    @Override
    public String toString() {
        return String.format("P2<%s %s>", a, b);
    }

    @Override
    public int hashCode() {
        return (a != null ? a.hashCode() : 0) +
                (b != null ? b.hashCode() * 31 : 0);
    }

    @Override
    public boolean equals(Object o) {
        if (a == null || b == null) return a == b;
        else return a.equals(b);
    }
}

@@ -738,61 +738,233 @@
   if
- (a == null %7C%7C b == null) return a == b;%0A        else
+(!(o instanceof P2)) return false;%0A        P2 other = (P2) o;%0A        boolean aIsEqual = (a == null) ? other.a == null : a.equals(other.a);%0A        boolean bIsEqual = (b == null) ? other.b == null : b.equals(other.b);%0A       
  ret
@@ -972,18 +972,27 @@
 rn a
-.e
+IsE
 qual
-s(b)
+ && bIsEqual
 ;%0A  

Fix P2 equals()