Collections • Lesson 28/100
Sorting
Sorting collections
📚
Learn💻
Code❓
Quiz🏆
Practice⭐
Complete📚 Lý thuyết
Kotlin có nhiều cách **sắp xếp** collections:
**Immutable (trả về list mới):**
- sorted() - tăng dần
- sortedDescending() - giảm dần
- sortedBy { selector } - theo property
- sortedByDescending { }
**Mutable (thay đổi list gốc):**
- sort(), sortDescending()
- sortBy { }, sortByDescending { }