Skip to content

Instantly share code, notes, and snippets.

@creativedrewy
Created January 11, 2019 22:15
Show Gist options
  • Save creativedrewy/ea30c10e25055858c0b9cdecf7ee4e95 to your computer and use it in GitHub Desktop.
Save creativedrewy/ea30c10e25055858c0b9cdecf7ee4e95 to your computer and use it in GitHub Desktop.
pairTo.kt
/**
* Combine two objects into a Pair
*/
infix fun <A, B> A.pairTo(that: B): Pair<A, B> = Pair(this, that)
/**
* Combine three objects into a Triple (by way of one Pair and a new value)
*/
infix fun <A, B, C> Pair<A, B>.tripleTo(that: C) = Triple(first, second, that)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment