poohbar06/14/2019, 3:28 PM
intellij is highlighting the
(argument as List<String>?)?.orEmpty()
as "This call is useless" why is it useless?
tddmonkey06/14/2019, 3:30 PM
works on a nullable list
poohbar06/14/2019, 3:30 PM
blows my mind
tddmonkey06/14/2019, 3:34 PM
António Bastião06/16/2019, 10:04 AM
pindab0ter06/17/2019, 12:40 PM
is useless as the
-function (https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/or-empty.html) is called on an instance of type
and returns an empty list in the case that the collection or list is
. Adding the safe call operator would cause
to only be called when it is not null, which would be useless since the function’s purpose is to do something when it’s reciever is null.