Unlike Java, Kotlin has two different interfaces for working with collections. The plain collection interface which handles accessing data and the MutableCollection interface that handles modifying the data. In this video, get an overview of both types.
- [Instructor] Unlike Java, Kotlin has two different…interfaces for working with collections.…The plain Collection interface handles accessing data…and then the MutableCollection interface…handles modifying the data.…As you can see here, this interface lets you check the size…and contents of the Collection…as well as iterate over its items,…whereas the MutableCollection interface extends it…with the additional ability to add, remove,…and clear the contents of the collection.…Just to illustrate, if we created an array list of integers…and declared the variable type to be collection events,…then we would receive an unresolved reference error…when attempting to invoke the add method.…
Now this is because the Kotin Collection interface…does not contain that particular method,…but if we change the return type to be a MutableCollection,…then we're good to go and we can add elements to our list…of numbers.…This type of separation is useful for reducing bugs…in your code and making your intent clear.…When it comes to collections in Kotlin,…
- What Kotlin has to offer
- Working with lambdas
- Common Android extension functions
- Kotlin Android Extensions overview
- Making use of the Anko library
- Working with coroutines
- Nullability and collections
Skill Level Intermediate
Android App Development: Data Persistence Librarieswith Annyce Davis4h 52m Intermediate
Developing AWS Lambda Functions with Kotlinwith Troy Miles1h 55m Intermediate
1. Kotlin Overview
2. Extension Functions and Properties
3. Incorporating Anko
4. Advanced Anko
5. Working with Collections
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.