karelpeeters
10/26/2017, 11:24 PMif (current is Set<*> && ...)
even do? Check whether it isn't null?bdawg.io
10/26/2017, 11:25 PMkarelpeeters
10/26/2017, 11:25 PM!= null
, this is just obvustication ☺️.bj0
10/26/2017, 11:26 PM!= null
, or better yet, ?.let {}
bdawg.io
10/26/2017, 11:26 PMis
gives a smart castkarelpeeters
10/26/2017, 11:27 PMbdawg.io
10/26/2017, 11:30 PMfilterStates[requested]?.takeIf { it.isNotEmpty() }?.let { additional ->
filters[property]?.let { current ->
if (current.isNotEmpty()) {
filters[property] = current.plus(additional)
} else {
filters[property] = additional
}
}
}
karelpeeters
10/26/2017, 11:31 PM!= null
.bj0
10/26/2017, 11:32 PMif()
anyway, you can combine the !=null
in there to make it a little shorterbdawg.io
10/26/2017, 11:35 PMif
also contains additional conditions. Is the suggestion there to do value!!.isNotEmpty()
instead of using the smart cast?karelpeeters
10/26/2017, 11:39 PMfun foo(x: String?) {
if(x != null && x.length == 2)
println("hey")
}
compiles.