Packages

c

scala

Tuple2

final case class Tuple2[+T1, +T2](_1: T1, _2: T2) extends Product2[T1, T2] with Product with Serializable

A tuple of 2 elements; the canonical representation of a scala.Product2.

_1

Element 1 of this Tuple2

_2

Element 2 of this Tuple2

Source
Tuple2.scala
Linear Supertypes
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Tuple2
  2. Serializable
  3. Product2
  4. Product
  5. Equals
  6. AnyRef
  7. Any
Implicitly
  1. by tuple2ToZippedOps
  2. by any2stringadd
  3. by StringFormat
  4. by Ensuring
  5. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new Tuple2(_1: T1, _2: T2)

    Create a new tuple with 2 elements.

    Create a new tuple with 2 elements. Note that it is more idiomatic to create a Tuple2 via (t1, t2)

    _1

    Element 1 of this Tuple2

    _2

    Element 2 of this Tuple2

Value Members

  1. val _1: T1

    A projection of element 1 of this Product.

    A projection of element 1 of this Product.

    returns

    A projection of element 1.

    Definition Classes
    Tuple2Product2
  2. val _2: T2

    A projection of element 2 of this Product.

    A projection of element 2 of this Product.

    returns

    A projection of element 2.

    Definition Classes
    Tuple2Product2
  3. def productArity: Int

    The arity of this product.

    The arity of this product.

    returns

    2

    Definition Classes
    Product2Product
  4. def productElement(n: Int): Any

    Returns the n-th projection of this product if 0 <= n < productArity, otherwise throws an IndexOutOfBoundsException.

    Returns the n-th projection of this product if 0 <= n < productArity, otherwise throws an IndexOutOfBoundsException.

    n

    number of the projection to be returned

    returns

    same as ._(n+1), for example productElement(0) is the same as ._1.

    Definition Classes
    Product2Product
    Annotations
    @throws(clazz = classOf[IndexOutOfBoundsException])
    Exceptions thrown

    IndexOutOfBoundsException if the n is out of range(n < 0 || n >= 2).

  5. def productElementNames: Iterator[String]

    An iterator over the names of all the elements of this product.

    An iterator over the names of all the elements of this product.

    Definition Classes
    Product
  6. def swap: (T2, T1)

    Swaps the elements of this Tuple.

    Swaps the elements of this Tuple.

    returns

    a new Tuple where the first element is the second element of this Tuple and the second element is the first element of this Tuple.

  7. def toString(): String

    Creates a String representation of this object.

    Creates a String representation of this object. The default representation is platform dependent. On the java platform it is the concatenation of the class name, "@", and the object's hashcode in hexadecimal.

    returns

    a String representation of the object.

    Definition Classes
    Tuple2 → AnyRef → Any

Deprecated Value Members

  1. def invert[El1, It1[a] <: Iterable[a], El2, It2[a] <: Iterable[a], That](implicit w1: <:<[T1, It1[El1]], w2: <:<[T2, It2[El2]], bf: BuildFrom[T1, (El1, El2), That]): That
    Implicit
    This member is added by an implicit conversion from (T1, T2) toOps[T1, T2] performed by method tuple2ToZippedOps in scala.Predef.
    Definition Classes
    Ops
    Annotations
    @deprecated
    Deprecated

    (Since version 2.13.0) Use xs.lazyZip(yz).map((_, _))

  2. def zipped[El1, It1 <: Iterable[El1], El2, It2 <: Iterable[El2]](implicit w1: (T1) => IterableOps[El1, Iterable, It1] with It1, w2: (T2) => IterableOps[El2, Iterable, It2] with It2): Tuple2Zipped[El1, It1, El2, It2]
    Implicit
    This member is added by an implicit conversion from (T1, T2) toOps[T1, T2] performed by method tuple2ToZippedOps in scala.Predef.
    Definition Classes
    Ops
    Annotations
    @deprecated
    Deprecated

    (Since version 2.13.0) Use xs.lazyZip(ys)