Q:

What is the correct way to compare two Pair? 

What is the correct way to compare two Pair<?,? > ? 
I use this code, but I'm not 100% sure about it? 
May be you know another better solution? 
public boolean equals(Object other) {
        if (other instanceof Pair<?,? >) {
            Pair<?, ? > otherPair = (Pair<?, ? >) other;
            return  equalsPart(this._first, otherPair._first) &&  equalsPart(this._second, otherPair._second);
        }
        return false;
    }

public boolean equalsPart(Class<? > one, Class<? > two) {
    return ((one== two || (one!= null && two ! = null && one.equals(two))));
}

A:

public boolean equals(Object other) {
        if(this == other)
            return true;

        if (!( other instanceof Pair)) {
            return false;
        }

        Pair<?, ? > otherPair = (Pair<?, ? >) other;

        return Equality.equals(this.first,otherPair._first) &&
               Equality.equals(this._second, otherPair._second);
    }

    class Equality{
         public static boolean equals(Object first, Object second){ 
              return first == null ?  second == null : first.equals(second);
         }
    }

You will find this kind of idiom being followed in many libraries for equals().  A precondition check and a fail fast  approach to equals(). 
Have created a new Utility Equality for use in further classes which improves readability as well as provides proper null checking.