Class Triple<A,B,C>

java.lang.Object
org.drasyl.util.Triple<A,B,C>
All Implemented Interfaces:
Serializable

public class Triple<A,B,C> extends Object implements Serializable
A tuple of three elements.

Inspired by: https://github.com/javatuples/javatuples/blob/master/src/main/java/org/javatuples/Triplet.java

See Also:
  • Method Details

    • hashCode

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

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • first

      public A first()
      Returns:
      the first element
    • second

      public B second()
      Returns:
      the second element
    • third

      public C third()
      Returns:
      the third element
    • of

      public static <A, B, C> Triple<A,B,C> of(A first, B second, C third)

      Obtains a tuple of three elements inferring the generic types.

      This factory allows the triple to be created using inference to obtain the generic types.

      Type Parameters:
      A - the first element type
      B - the second element type
      C - the third element type
      Parameters:
      first - the first element, may be null
      second - the second element, may be null
      third - the third element, may be null
      Returns:
      a triple formed from the three parameters, not null