Class Triple<A,​B,​C>

  • Type Parameters:
    A - the first element type
    B - the second element type
    C - the third element type
    All Implemented Interfaces:
    java.io.Serializable

    public class Triple<A,​B,​C>
    extends java.lang.Object
    implements java.io.Serializable
    Generic triple (3-tuple).
    Author:
    Dimitrios Michail
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected A first
      The first element
      protected B second
      The second element
      protected C third
      The third element
    • Constructor Summary

      Constructors 
      Constructor Description
      Triple​(A a, B b, C c)
      Create a new triple
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)  
      A getFirst()
      Get the first element
      B getSecond()
      Get the second element
      C getThird()
      Get the third element
      <E> boolean hasElement​(E e)
      Assess if this triple contains an element.
      int hashCode()  
      static <A,​B,​C>
      Triple<A,​B,​C>
      of​(A a, B b, C c)
      Create a new triple.
      void setFirst​(A a)
      Set the first element
      void setSecond​(B b)
      Set the second element
      void setThird​(C c)
      Set the third element
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

      • first

        protected A first
        The first element
      • second

        protected B second
        The second element
      • third

        protected C third
        The third element
    • Constructor Detail

      • Triple

        public Triple​(A a,
                      B b,
                      C c)
        Create a new triple
        Parameters:
        a - the first element
        b - the second element
        c - the third element
    • Method Detail

      • getFirst

        public A getFirst()
        Get the first element
        Returns:
        the first element
      • getSecond

        public B getSecond()
        Get the second element
        Returns:
        the second element
      • getThird

        public C getThird()
        Get the third element
        Returns:
        the third element
      • setFirst

        public void setFirst​(A a)
        Set the first element
        Parameters:
        a - the element to be assigned
      • setSecond

        public void setSecond​(B b)
        Set the second element
        Parameters:
        b - the element to be assigned
      • setThird

        public void setThird​(C c)
        Set the third element
        Parameters:
        c - the element to be assigned
      • hasElement

        public <E> boolean hasElement​(E e)
        Assess if this triple contains an element.
        Type Parameters:
        E - the element type
        Parameters:
        e - The element in question
        Returns:
        true if contains the element, false otherwise
      • toString

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

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

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

        public static <A,​B,​C> Triple<A,​B,​C> of​(A a,
                                                                       B b,
                                                                       C c)
        Create a new triple.
        Type Parameters:
        A - the first element type
        B - the second element type
        C - the third element type
        Parameters:
        a - first element
        b - second element
        c - third element
        Returns:
        new triple