gabrielfv
09/18/2018, 3:12 PMgabrielfv
09/18/2018, 3:14 PMOption
as I feel it was made to deal with null-safety, which is something Kotlin has it's own way to deal with.Shawn
09/18/2018, 3:15 PMShawn
09/18/2018, 3:15 PMpablisco
09/18/2018, 3:15 PM.let
in the form of property => it.sub
there would controversy 🤔 The power of familiarity heheShawn
09/18/2018, 3:16 PM?:
, there’s not much we can do about that even if we disliked itShawn
09/18/2018, 3:16 PMpablisco
09/18/2018, 3:16 PMOption
is that it encourages to handle the negative case (I think)Alowaniak
09/18/2018, 3:16 PMShawn
09/18/2018, 3:17 PMNikky
09/18/2018, 3:19 PMPaul Woitaschek
09/18/2018, 3:24 PMOptional
/ Option
Jeremy Rempel
09/18/2018, 4:06 PMJeremy Rempel
09/18/2018, 4:09 PMfabricio
09/18/2018, 4:12 PMreturn response.events?.flatMap { evt -> evt.questions?.map { it.correct }!!.toList() }
if evt.questions
is null it will return null in the flatMap or it will throw the !!
before .toList()
?jw
09/18/2018, 4:12 PMfabricio
09/18/2018, 4:13 PMjw
09/18/2018, 4:13 PM?.
thenfabricio
09/18/2018, 4:14 PMorangy
toList
there, and for flatMap to ignore one that returned null use ?: emptyList()
orangy
return response.events?.flatMap { evt -> evt.questions?.map { it.correct } ?: emptyList() }
fabricio
09/18/2018, 4:16 PMlex
09/19/2018, 5:08 AMjacob
09/19/2018, 5:09 AMlex
09/19/2018, 5:12 AMianbrandt
09/19/2018, 3:32 PMpavel
09/19/2018, 5:31 PMpavel
09/19/2018, 5:34 PMpavel
09/19/2018, 5:35 PMUS-ASCII
and UTF-8
are obvious alternatives