Move to method to Tuples
This commit is contained in:
@@ -18,13 +18,6 @@ public fun TODO(): Nothing = throw NotImplementedError()
|
||||
public fun TODO(reason: String): Nothing = throw NotImplementedError("An operation is not implemented: $reason")
|
||||
|
||||
|
||||
/**
|
||||
* Creates a tuple of type [Pair] from this and [that].
|
||||
*
|
||||
* This can be useful for creating [Map] literals with less noise, for example:
|
||||
* @sample test.collections.MapTest.createUsingTo
|
||||
*/
|
||||
public fun <A, B> A.to(that: B): Pair<A, B> = Pair(this, that)
|
||||
|
||||
/**
|
||||
* Calls the specified function [f] and returns its result.
|
||||
|
||||
@@ -28,6 +28,14 @@ public data class Pair<out A, out B>(
|
||||
public override fun toString(): String = "($first, $second)"
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a tuple of type [Pair] from this and [that].
|
||||
*
|
||||
* This can be useful for creating [Map] literals with less noise, for example:
|
||||
* @sample test.collections.MapTest.createUsingTo
|
||||
*/
|
||||
public fun <A, B> A.to(that: B): Pair<A, B> = Pair(this, that)
|
||||
|
||||
/**
|
||||
* Converts this pair into a list.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user