Game of collections

Report a typo

Your friend is a big fan of Game of Thrones and Fight Club. He wrote tricky functions that identify the analog of Tyler Durdan in Game of Thrones:

fun findRepeatedNames(heroes: Collection<String>) = heroes.filter { it.contains("Jon Snow") }

fun main() {
    val heroes = listOf("Jon Snow", "Littlefinger", "Robert I Baratheon", "Jon Snow")

    println(findRepeatedNames(heroes))
}

What will println() output?

Select one option from the list
___

Create a free account to access the full topic