Safe cast type to String

Report a typo

Look at the code below:

fun convertToStringList(objects: List<Any>): List<String> {
    val stringList = mutableListOf<String>()
    for (obj in objects) {
        val str = obj /*___*/ String
        if (str != null) {
            stringList.add(str)
        }
    }
    return stringList
}

Choose the correct operator to replace the comment on line 4.

Select one option from the list
___

Create a free account to access the full topic