Class Pair<T>

  • Type Parameters:
    T -
    All Implemented Interfaces:
    java.io.Serializable

    public final class Pair<T>
    extends java.lang.Object
    implements java.io.Serializable
    A Pair of objects. Implements an equals and hashCode so that it can be used as key in hashes. Based on the JUNG graph library implementation.
    Author:
    duarte_j
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      Pair​(T value1, T value2)
      Creates a Pair from the specified elements.
    • Constructor Detail

      • Pair

        public Pair​(T value1,
                    T value2)
        Creates a Pair from the specified elements.
        Parameters:
        value1 - the first value in the new Pair
        value2 - the second value in the new Pair
        Throws:
        java.lang.IllegalArgumentException - if either argument is null
    • Method Detail

      • getFirst

        public T getFirst()
      • getSecond

        public T getSecond()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object