Although we should prefer working with collections over arrays, Kotlin makes it easy for you to work with them. In this video, learn various options for creating arrays of objects and primitives with Kotlin.
- [Instructor] Arrays in Kotlin are classes…with a type parameter.…In this example, we have an arrayOf ints,…initialized with the values one, two, and three.…Now if we wanted to do the same thing in Java…just as a comparison, we'd define it this way…with the type followed by brackets and then the name.…In fact, these two things are comparable…because the default array class creates…boxed representations of the types.…We just saw one way to initialize an array in Kotlin…with the arrayOf function.…
But you can also use the array function…with your desired size of the array…as well as a lambda which can initialize each element.…In this example, we're creating an array of strings…with the size of two and then setting each value…to an empty string.…You can also use the arrayOfNulls function…if you want to create an array of a particular size…with null elements.…In this case, we created an array of strings…with two null values, then set the first one…to another string.…
So if we print them out, we're going to get Heather…
- 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.