Class Tuple

java.lang.Object
com.couchbase.client.core.lang.Tuple

public final class Tuple
extends Object
Static factory class for various Tuples. A tuple should be used if more than one argument needs to be passed through a observable. Note that there are intentionally only tuples with a maximum of five elements, because if more are needed it hurts readability and value objects should be used instead. Also keep in mind that if a tuple is used instead of a value object semantics might get lost, so use them sparingly.
Since:
1.0
Author:
Michael Nitschinger
  • Method Summary

    Modifier and Type Method Description
    static <T1,​ T2> Tuple2<T1,​T2> create​(T1 v1, T2 v2)
    Creates a tuple with two values.
    static <T1,​ T2,​ T3> Tuple3<T1,​T2,​T3> create​(T1 v1, T2 v2, T3 v3)
    Creates a tuple with three values.
    static <T1,​ T2,​ T3,​ T4>
    Tuple4<T1,​T2,​T3,​T4>
    create​(T1 v1, T2 v2, T3 v3, T4 v4)
    Creates a tuple with four values.
    static <T1,​ T2,​ T3,​ T4,​ T5>
    Tuple5<T1,​T2,​T3,​T4,​T5>
    create​(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5)
    Creates a tuple with five values.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • create

      public static <T1,​ T2> Tuple2<T1,​T2> create​(T1 v1, T2 v2)
      Creates a tuple with two values.
      Parameters:
      v1 - the first value.
      v2 - the second value.
      Returns:
      a tuple containing the values.
    • create

      public static <T1,​ T2,​ T3> Tuple3<T1,​T2,​T3> create​(T1 v1, T2 v2, T3 v3)
      Creates a tuple with three values.
      Parameters:
      v1 - the first value.
      v2 - the second value.
      v3 - the third value.
      Returns:
      a tuple containing the values.
    • create

      public static <T1,​ T2,​ T3,​ T4> Tuple4<T1,​T2,​T3,​T4> create​(T1 v1, T2 v2, T3 v3, T4 v4)
      Creates a tuple with four values.
      Parameters:
      v1 - the first value.
      v2 - the second value.
      v3 - the third value.
      v4 - the fourth value.
      Returns:
      a tuple containing the values.
    • create

      public static <T1,​ T2,​ T3,​ T4,​ T5> Tuple5<T1,​T2,​T3,​T4,​T5> create​(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5)
      Creates a tuple with five values.
      Parameters:
      v1 - the first value.
      v2 - the second value.
      v3 - the third value.
      v4 - the fourth value.
      v5 - the fifth value.
      Returns:
      a tuple containing the values.