public override bool Equals(object o)
 {
     if (o is Edu.Stanford.Nlp.Util.Pair)
     {
         Edu.Stanford.Nlp.Util.Pair p = (Edu.Stanford.Nlp.Util.Pair)o;
         return((first == null ? p.First() == null : first.Equals(p.First())) && (second == null ? p.Second() == null : second.Equals(p.Second())));
     }
     else
     {
         return(false);
     }
 }
 /// <summary>Compares this <code>Pair</code> to another object.</summary>
 /// <remarks>
 /// Compares this <code>Pair</code> to another object.
 /// If the object is a <code>Pair</code>, this function will work providing
 /// the elements of the <code>Pair</code> are themselves comparable.
 /// It will then return a value based on the pair of objects, where
 /// <code>p &gt; q iff p.first() &gt; q.first() ||
 /// (p.first().equals(q.first()) && p.second() &gt; q.second())</code>.
 /// If the other object is not a <code>Pair</code>, it throws a
 /// <code>ClassCastException</code>.
 /// </remarks>
 /// <param name="another">the <code>Object</code> to be compared.</param>
 /// <returns>
 /// the value <code>0</code> if the argument is a
 /// <code>Pair</code> equal to this <code>Pair</code>; a value less than
 /// <code>0</code> if the argument is a <code>Pair</code>
 /// greater than this <code>Pair</code>; and a value
 /// greater than <code>0</code> if the argument is a
 /// <code>Pair</code> less than this <code>Pair</code>.
 /// </returns>
 /// <exception cref="System.InvalidCastException">
 /// if the argument is not a
 /// <code>Pair</code>.
 /// </exception>
 /// <seealso cref="Java.Lang.IComparable{T}"/>
 public virtual int CompareTo(Edu.Stanford.Nlp.Util.Pair <T1, T2> another)
 {
     if (First() is IComparable)
     {
         int comp = ((IComparable <T1>)First()).CompareTo(another.First());
         if (comp != 0)
         {
             return(comp);
         }
     }
     if (Second() is IComparable)
     {
         return(((IComparable <T2>)Second()).CompareTo(another.Second()));
     }
     if ((!(First() is IComparable)) && (!(Second() is IComparable)))
     {
         throw new AssertionError("Neither element of pair comparable");
     }
     return(0);
 }
 /// <summary>
 /// If first and second are Strings, then this returns an MutableInternedPair
 /// where the Strings have been interned, and if this Pair is serialized
 /// and then deserialized, first and second are interned upon
 /// deserialization.
 /// </summary>
 /// <param name="p">A pair of Strings</param>
 /// <returns>MutableInternedPair, with same first and second as this.</returns>
 public static Edu.Stanford.Nlp.Util.Pair <string, string> StringIntern(Edu.Stanford.Nlp.Util.Pair <string, string> p)
 {
     return(new Pair.MutableInternedPair(p));
 }