Skip to content

Commit 70e064f

Browse files
authored
Rename filterNull to filterNotNull such as Kotlin Std Collections (#259)
1 parent 0a85e9c commit 70e064f

File tree

2 files changed

+10
-2
lines changed
  • arrow-libs/fx/arrow-fx-coroutines/src

2 files changed

+10
-2
lines changed

arrow-libs/fx/arrow-fx-coroutines/src/main/kotlin/arrow/fx/coroutines/stream/Stream.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -2153,14 +2153,14 @@ fun <O> Stream<O>.repartition(S: Semigroup<O>, f: (O) -> Chunk<O>): Stream<O> =
21532153
* //sampleStart
21542154
* suspend fun main(): Unit =
21552155
* Stream(1, 2, null, 3, None)
2156-
* .filterNull()
2156+
* .filterNotNull()
21572157
* .compile()
21582158
* .toList()
21592159
* .let(::println) //[1, 2, 3]
21602160
* //sampleEnd
21612161
* ```
21622162
*/
2163-
fun <O : Any> Stream<O?>.filterNull(): Stream<O> =
2163+
fun <O : Any> Stream<O?>.filterNotNull(): Stream<O> =
21642164
mapFilter { it }
21652165

21662166
/**

arrow-libs/fx/arrow-fx-coroutines/src/test/kotlin/arrow/fx/coroutines/stream/StreamTest.kt

+8
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,14 @@ class StreamTest : StreamSpec(spec = {
235235
}
236236
}
237237

238+
"filterNotNull" {
239+
checkAll(Arb.stream(Arb.int().orNull())) { s ->
240+
s.filterNotNull()
241+
.compile()
242+
.toList() shouldBe s.compile().toList().filterNotNull()
243+
}
244+
}
245+
238246
"append" {
239247
checkAll(Arb.stream(Arb.int()), Arb.stream(Arb.int())) { s1, s2 ->
240248
s1.append { s2 }.compile().toList() shouldBe s1.compile().toList() + s2.compile().toList()

0 commit comments

Comments
 (0)