Bird
0
0

In Kotlin, which interface guarantees that the collection cannot be changed after creation?

easy📝 Conceptual Q1 of 15
Kotlin - Collections Fundamentals
In Kotlin, which interface guarantees that the collection cannot be changed after creation?
AList
BMutableList
CArrayList
DMutableCollection
Step-by-Step Solution
Solution:
  1. Step 1: Understand Kotlin collection interfaces

    Kotlin provides immutable interfaces like List and mutable ones like MutableList.
  2. Step 2: Identify immutable interface

    List interface does not allow modification methods, so it guarantees immutability.
  3. Final Answer:

    List -> Option A
  4. Quick Check:

    Immutable interface = List [OK]
Quick Trick: Immutable interfaces lack modification methods like add or remove [OK]
Common Mistakes:
MISTAKES
  • Confusing MutableList with List
  • Thinking ArrayList is immutable
  • Assuming MutableCollection is immutable

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kotlin Quizzes