Class Tuple2<A0,A1>

java.lang.Object
eu.bandm.tools.util.anon.Tuple2<A0,A1>
Type Parameters:
A0 - the type of the first component.
A1 - the type of the second component.
All Implemented Interfaces:
Tuploid1<A0>, Tuploid2<A0,A1>, Serializable

public class Tuple2<A0,A1> extends Object implements Tuploid2<A0,A1>, Serializable
Implementation of a tuple with two components.
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Convenience class for building a list of 2-tuples.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Tuple2(A0 elem0, A1 elem1)
    Only constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    equals(Tuple2<?,?> t)
    Check whether all components of both tuples are equal.
    boolean
    Check whether o is a 2-tuple and all components of both tuples are equal.
    Get the value of the first component.
    Get the value of the second component.
    int

    Methods inherited from class java.lang.Object

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

    • Tuple2

      public Tuple2(@Opt A0 elem0, @Opt A1 elem1)
      Only constructor.
      Parameters:
      elem0 - the value for the first component
      elem1 - the value for the second component
  • Method Details

    • get0

      @Opt public A0 get0()
      Get the value of the first component.
      Specified by:
      get0 in interface Tuploid1<A0>
      Returns:
      the value of the first component.
    • get1

      @Opt public A1 get1()
      Get the value of the second component.
      Specified by:
      get1 in interface Tuploid2<A0,A1>
      Returns:
      the value of the second component.
    • equals

      public boolean equals(Object o)
      Check whether o is a 2-tuple and all components of both tuples are equal.
      Overrides:
      equals in class Object
      Parameters:
      o - the object to compare with
      Returns:
      whether o is a 2-tuple and both tuples have equal components.
    • equals

      public boolean equals(Tuple2<?,?> t)
      Check whether all components of both tuples are equal.
      Parameters:
      t - the 2-tuple to compare with
      Returns:
      whether both tuples have equal components.
    • hashCode

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

      public String toString()
      Overrides:
      toString in class Object