W3cubDocs

/Kotlin

Triple

Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)
data class Triple<out A, out B, out C> : Serializable

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:

import kotlin.test.*

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

Parameters

A - type of the first value.

B - type of the second value.

C - type of the third value.

Constructors

Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)

<init>

Represents a triad of values

Triple(first: A, second: B, third: C)

Properties

Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)

first

First value.

val first: A
Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)

second

Second value.

val second: B
Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)

third

Third value.

val third: C

Functions

Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)

toString

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

fun toString(): String

Extension Functions

Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)

toList

Converts this triple into a list.

fun <T> Triple<T, T, T>.toList(): List<T>

© 2010–2020 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-triple/index.html