Class Triple<T1,​T2,​T3>

  • Type Parameters:
    T1 - type of first object
    T2 - type of second object
    T3 - type of third object
    All Implemented Interfaces:
    java.io.Serializable

    public class Triple<T1,​T2,​T3>
    extends java.lang.Object
    implements java.io.Serializable

    A simple immutable encapsulation for 3 objects.

    An instance of this Pair can be used in several threads concurrently.

    Author:
    agz
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      Triple​(T1 first, T2 second, T3 third)
      Creates a new Triple with the specified objects.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      T1 getFirst()
      Returns the first object.
      T2 getSecond()
      Returns the second object.
      T3 getThird()
      Returns the third object.
      int hashCode()  
      static <T1,​T2,​T3>
      Triple<T1,​T2,​T3>
      newInstance​(T1 first, T2 second, T3 third)
      Convenience factory method for letting the compiler do the type inference.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Triple

        public Triple​(T1 first,
                      T2 second,
                      T3 third)
        Creates a new Triple with the specified objects.

        All objects may be null.

        Parameters:
        first - first object
        second - second object
        third - third object
    • Method Detail

      • getFirst

        public final T1 getFirst()
        Returns the first object.
        Returns:
        first object
      • getSecond

        public final T2 getSecond()
        Returns the second object.
        Returns:
        second object
      • getThird

        public final T3 getThird()
        Returns the third object.
        Returns:
        third object
      • equals

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

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

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

        public static <T1,​T2,​T3> Triple<T1,​T2,​T3> newInstance​(T1 first,
                                                                                      T2 second,
                                                                                      T3 third)
        Convenience factory method for letting the compiler do the type inference.
        Parameters:
        first - The first object in the triple
        second - The second object in the triple
        third - The third object in the triple
        Returns:
        A triple consisting of the given objects