Move to method to Tuples

This commit is contained in:
Ilya Gorbunov
2015-09-22 16:05:54 +03:00
parent 6bb88df693
commit 27ab643d3f
2 changed files with 8 additions and 7 deletions
@@ -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.
*/