paulex
10/09/2018, 12:08 PMEgor Trutenko
10/09/2018, 12:16 PMfetchData(0, statusFilter, priorityFilter ?: array("4"))
or check it for nullability inside the function (of course you'll also need to make the parameter nullable):
private fun fetchData(offfset ..., priority: Array<String>?) {
val actualPriority = priority ?: array("4")
// use actualPriority in the rest of the function
}
However, if you want to keep your function intact, I may also suggest the following:
priorityFilter?.let { fetchData(0, statusFilter, it) } ?: fetchData(0, statusFilter)
Allan Wang
10/09/2018, 12:53 PM?:
as shown aboverkeazor
10/10/2018, 12:37 PM