Beyond simple filtering and mapping of your collections, Kotlin provides several functions which allow you to aggregate your data as well. In this video, learn how to make use of the following functions: min, minBy, maxBy, and sum.
- [Instructor] Beyond simple filtering and mapping…of your collection data, Kotlin provides several functions…which allow you to aggregate your data as well.…Let's take a look at the aggregate operations file…so that we can get some deeper insight into our collection…of planets.…So our first function is "fewestMoons" here on line 11.…And since each planet has a given number of known moons,…we want to get the smallest number.…Now we can do this by first getting the list…which contains the number of known moons only.…
So we'll just create a variable,…we'll set it equal to "moons", we'll get our list of planets…and then we'll call the map function on it…and let's provide our "Planet",…"knownMoons" and the member reference.…Perfect.…So let's come here on line 16 and print this list out first.…And then we can duplicate that…and we're going to call the min function…in order to get the smallest number of known moons.…
So if we run this test, what we would hope to see…is first our list of all the total number of moons…
- 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 Davis3h 59m 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.