reik.schatz
02/11/2019, 1:00 PMval items = Arrays.asList("a", "b", "c")
// doesn't compile because it is Stream<String?>!
val stream: Stream<String> = items
.stream()
.map { item ->
// call that returns nullable, i.e. String?
}
.filter(Objects::nonNull)
utikeev
02/11/2019, 1:05 PMitems.filterNotNull().stream()
suit?reik.schatz
02/11/2019, 1:08 PMhudsonb
02/11/2019, 1:08 PM!!
is sometimes a necessary evil when working with platform types:
val stream: Stream<String> = items
.stream()
.filter(Objects::nonNull)
.map { it!! }
reik.schatz
02/11/2019, 1:09 PM