Tuple2

final case class Tuple2[@specialized(Int, Long, Double, Char, Boolean) +T1, @specialized(Int, Long, Double, Char, Boolean) +T2](_1: T1, _2: T2) extends Product2[T1, T2]

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

Value Params
_1

Element 1 of this Tuple2

_2

Element 2 of this Tuple2

Constructor

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

Source
Tuple2.scala
trait Product2[T1, T2]
trait Product
trait Equals
class Object
trait Matchable
class Any

Value members

Concrete methods

def swap: (T2, T1)

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.

Source
Tuple2.scala
override def toString(): String
Definition Classes
Any
Source
Tuple2.scala

Inherited methods

override def productArity: Int

The arity of this product.

Returns

2

Definition Classes
Inherited from
Product2
Source
Product2.scala
@throws(scala.Predef.classOf[scala.IndexOutOfBoundsException])
override def productElement(n: Int): Any

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

Value Params
n

number of the projection to be returned

Returns

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

Throws
IndexOutOfBoundsException

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

Definition Classes
Inherited from
Product2
Source
Product2.scala

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

Inherited from
Product
Source
Product.scala

An iterator over all the elements of this product.

Returns

in the default implementation, an Iterator[Any]

Inherited from
Product
Source
Product.scala