Complete the code to check if the list is empty.
if (myList.[1]()) { println("List is empty") }
The isEmpty() function returns true if the collection has no elements.
Complete the code to check if the list has exactly 3 elements.
if (myList.[1] == 3) { println("List has 3 elements") }
The size property gives the number of elements in the collection.
Fix the error in the code to check if the list is not empty.
if (myList.[1]()) { println("List has elements") }
The isNotEmpty() function returns true if the collection has one or more elements.
Fill both blanks to create a map of words to their lengths, but only for words longer than 3 characters.
val lengths = words.filter { word -> word.length > 3 }.associate { word -> [1] to [2] }We map each word to its length property for words longer than 3 characters.
Fill all three blanks to create a filtered list of words with length greater than 4, then map to their uppercase forms.
val result = words.filter { it.[1] > [2] }.map { it.[3]() }We filter words where length is greater than 4, then map each word to its uppercase form using uppercase().