Rename Stream<T> to Sequence<T> and provide migration path via deprecated types and functions.
This commit is contained in:
@@ -376,8 +376,8 @@ class CollectionTest {
|
||||
expect(2000000000000, { listOf(3000000000000, 2000000000000).min() })
|
||||
expect('a', { listOf('a', 'b').min() })
|
||||
expect("a", { listOf("a", "b").min() })
|
||||
expect(null, { listOf<Int>().stream().min() })
|
||||
expect(2, { listOf(2, 3).stream().min() })
|
||||
expect(null, { listOf<Int>().sequence().min<Int>() })
|
||||
expect(2, { listOf(2, 3).sequence().min<Int>() })
|
||||
}
|
||||
|
||||
test fun max() {
|
||||
@@ -387,8 +387,8 @@ class CollectionTest {
|
||||
expect(3000000000000, { listOf(3000000000000, 2000000000000).max() })
|
||||
expect('b', { listOf('a', 'b').max() })
|
||||
expect("b", { listOf("a", "b").max() })
|
||||
expect(null, { listOf<Int>().stream().max() })
|
||||
expect(3, { listOf(2, 3).stream().max() })
|
||||
expect(null, { listOf<Int>().sequence().max<Int>() })
|
||||
expect(3, { listOf(2, 3).sequence().max<Int>() })
|
||||
}
|
||||
|
||||
test fun minBy() {
|
||||
@@ -397,8 +397,8 @@ class CollectionTest {
|
||||
expect(3, { listOf(2, 3).minBy { -it } })
|
||||
expect('a', { listOf('a', 'b').minBy { "x$it" } })
|
||||
expect("b", { listOf("b", "abc").minBy { it.length() } })
|
||||
expect(null, { listOf<Int>().stream().minBy { it } })
|
||||
expect(3, { listOf(2, 3).stream().minBy { -it } })
|
||||
expect(null, { listOf<Int>().sequence().minBy<Int, Int> { it } })
|
||||
expect(3, { listOf(2, 3).sequence().minBy<Int, Int> { -it } })
|
||||
}
|
||||
|
||||
test fun maxBy() {
|
||||
@@ -407,8 +407,8 @@ class CollectionTest {
|
||||
expect(2, { listOf(2, 3).maxBy { -it } })
|
||||
expect('b', { listOf('a', 'b').maxBy { "x$it" } })
|
||||
expect("abc", { listOf("b", "abc").maxBy { it.length() } })
|
||||
expect(null, { listOf<Int>().stream().maxBy { it } })
|
||||
expect(2, { listOf(2, 3).stream().maxBy { -it } })
|
||||
expect(null, { listOf<Int>().sequence().maxBy<Int, Int> { it } })
|
||||
expect(2, { listOf(2, 3).sequence().maxBy<Int, Int> { -it } })
|
||||
}
|
||||
|
||||
test fun minByEvaluateOnce() {
|
||||
@@ -416,7 +416,7 @@ class CollectionTest {
|
||||
expect(1, { listOf(5, 4, 3, 2, 1).minBy { c++; it * it } })
|
||||
assertEquals(5, c)
|
||||
c = 0
|
||||
expect(1, { listOf(5, 4, 3, 2, 1).stream().minBy { c++; it * it } })
|
||||
expect(1, { listOf(5, 4, 3, 2, 1).sequence().minBy<Int, Int> { c++; it * it } })
|
||||
assertEquals(5, c)
|
||||
}
|
||||
|
||||
@@ -425,7 +425,7 @@ class CollectionTest {
|
||||
expect(5, { listOf(5, 4, 3, 2, 1).maxBy { c++; it * it } })
|
||||
assertEquals(5, c)
|
||||
c = 0
|
||||
expect(5, { listOf(5, 4, 3, 2, 1).stream().maxBy { c++; it * it } })
|
||||
expect(5, { listOf(5, 4, 3, 2, 1).sequence().maxBy<Int, Int> { c++; it * it } })
|
||||
assertEquals(5, c)
|
||||
}
|
||||
|
||||
@@ -435,7 +435,7 @@ class CollectionTest {
|
||||
expect(3.0) { listOf(1.0, 2.0).sum() }
|
||||
expect(3000000000000) { arrayListOf<Long>(1000000000000, 2000000000000).sum() }
|
||||
expect(3.0.toFloat()) { arrayListOf<Float>(1.0.toFloat(), 2.0.toFloat()).sum() }
|
||||
expect(3.0.toFloat()) { streamOf<Float>(1.0.toFloat(), 2.0.toFloat()).sum() }
|
||||
expect(3.0.toFloat()) { sequenceOf<Float>(1.0.toFloat(), 2.0.toFloat()).sum() }
|
||||
}
|
||||
|
||||
test fun takeReturnsFirstNElements() {
|
||||
|
||||
Reference in New Issue
Block a user