Triple

data class Triple<out A, out B, out C>(val first: A, val second: B, val third: C) : Serializable(source)

Represents a triad of values

There is no meaning attached to values in this class, it can be used for any purpose. Triple exhibits value semantics, i.e. two triples are equal if all three components are equal. An example of decomposing it into values:

Since Kotlin

1.0

Parameters

A

type of the first value.

B

type of the second value.

C

type of the third value.

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val (a, b, c) = Triple(2, "x", listOf(null))
println(a) // 2
println(b) // x
println(c) // [null] 
   //sampleEnd
}

Constructors

Link copied to clipboard
constructor(first: A, second: B, third: C)

Properties

Link copied to clipboard
val first: A

First value.

Since Kotlin 1.0
Link copied to clipboard
val second: B

Second value.

Since Kotlin 1.0
Link copied to clipboard
val third: C

Third value.

Since Kotlin 1.0

Functions

Link copied to clipboard
fun <T> Triple<T, T, T>.toList(): List<T>

Converts this triple into a list.

Since Kotlin 1.0
Link copied to clipboard
open override fun toString(): String

Returns string representation of the Triple including its first, second and third values.

Since Kotlin 1.0