-
Notifications
You must be signed in to change notification settings - Fork 12
Tuples
Alex Zuzin edited this page Apr 13, 2017
·
2 revisions
Tuples can be made as follows:
val oneTuple = tuple(1)
val twoTuple = tuple(1, "2")
val threeTuple = tuple(1, "2", false)
// ... all the way to an 8-tuple
Two-tuples can also be created from, and converted to Kotlin Pair
s:
val twoTuple = (1 to "2").tuple()
val twoPair = twoTuple.pair()
A Kotlin Iterable
of any arity Tuple
s can be sequenced as follows:
val tupleOfSeqs: Tuple2<Seq<Int>, Seq<String>> =
listOf(tuple(1, "2"), tuple(3, "4")).sequence()
JΛVΛSLΛNG, (C) 2014 - 2017 javaslang.io