Add Sequence.orEmpty #KT-16552 Fixed

This commit is contained in:
Toshiaki Kameyama
2018-06-15 16:25:14 +09:00
committed by Ilya Gorbunov
parent 2ce0bca34e
commit c4b785de36
3 changed files with 28 additions and 0 deletions
@@ -543,6 +543,14 @@ public class SequenceTest {
assertEquals(listOf("act", "wast", "test"), sequenceOf("act", "test", "wast").sortedWith(comparator).toList())
}
@Test fun orEmpty() {
val s1: Sequence<Int>? = null
assertEquals(emptySequence(), s1.orEmpty())
val s2: Sequence<Int>? = sequenceOf(1)
assertEquals(s2, s2.orEmpty())
}
/*
test fun pairIterator() {
val pairStr = (fibonacci() zip fibonacci().map { i -> i*2 }).joinToString(limit = 10)