Kotlin Newbie to Pro - GENERICS - Part 29

preview_player
Показать описание
In this video you will get a basic overview of generics and learn how to implement your own generic functions and classes.

⭐ 300+ Quiz questions for all my videos
⭐ Take notes while watching my videos
⭐ Climb the leaderboard and get rewards
⭐ Create your FREE account now:

Рекомендации по теме
Комментарии
Автор

just finished the playlist. Thank you so much for this! I am in a beginner college course for mobile app dev and they skimmed over kotlin and threw us into android studio with Compose. I have been soo lost but man, this helped me out a lot! I can't wait to start your Compose playlist.

derekkolb
Автор

Just finished the whole Kotlin tutorial. Now I'm heading for the Android videos. Thank you so much for the great work!!!

julesverne
Автор

As an android developer junior, I needed a refresh course on the Kotlin language, this was just the playlist I needed, i just finished it in accelerated within one full day and it was perfect, you explain every notion very well and the exercises are great, now I'm confident to start new android projects in kotlin, thanks a lot for your work 👋

davidfz
Автор

After finishing the playlist, I gotta say one this. THIS MAN IS A LEGEND 👑

mrunknown
Автор

I finished the entire playlist. Man this was awesome. You cleared all my concepts. LOVE

cinnybun
Автор

For last example, every Type (T) that extend Number can be converted to Double without losing its precision value. & then we can convert the sum back to Type (T)

@Suppress("UNCHECKED_CAST")
fun <T : Number> List<T>.customSum(filter: (T) -> Boolean): T {
var sum = 0.0
for (item in this) {
if (filter(item)) {
sum += item.toDouble()
}
}
return sum as T
}

VikashSingh-dnkk
Автор

Just finished the whole playlist. The best I can do is liked all the videos on the playlist and subscribe as a payment for the incredible free content.

lutherevangelista
Автор

OMG I MADE IT THROUGH THE WHOLE COURSE! YOU DA MAN LACKNER!
I hope you have a good day, bye-bye!

alh
Автор

Great representation skill. I was expecting covariance and contravariant with in and out keyword. Expecting next video would be about that.

Tech-To-Logic
Автор

Hey, Philipp! Old video, I know, but I hope you get this comment anyway, because the amount of gratitude I feel to you at this moment is simply immeasurable.

I'm not exactly new to Kotlin, but neither do I have a lot of coding experience in it. This morning I was building a repository for reading from and writing to DataStore, and, seeing as I'd never used generics in Kotlin before, I was struggling with creating just two general functions to get the job done. I know to you, and many experienced programmers here, this might seem trivial, but I just kept failing, and kept trying, because I KNEW there HAS to be a way more refined than writing a dozen of functions for writing and reading every single type. As embarrassed as I feel even writing it in this forum, I have to tell you that suddenly I remembered your Kotlin playlist, and I only had to get to 3:28 when it hit me like a lightening, and now, thanks to this video of yours from 4 years ago, I have that elusive finesse I've been desperately searching for.

Thank you. Just thank you. From a happy newbie who's so-so proud of her first two generic type functions.

annaberkovitch
Автор

Nice video. [Minor] For the generics customSum() you can also take the initial sum value as input parameter avoiding the need to check for class types to decide it.

JunaidAzad
Автор

Thanks a lot, Philipp! You are a very good teacher/instructor!

Thanks for all you give.

Jonnhy
Автор

Thanks for this amazing serie, it was really clear and I enjoyed learning Kotlin through your videos !

TerryNarc
Автор

Hi, I'm learning Kotlin and these videos are great! I just wanted to point out one confusing thing to me while I was watching. Why is it possible to call List<Shape>.customFilter on a List<Circle>, List<Square>, etc..? Answer: It's because Kotlin has declaration-site variance and the definition of generic List is: public interface List<out E> : Collection<E> { ... }. The "out E" makes it covariant. e.g. List<Circle> is a subtype of List<Shape>. And we can do this because List is read-only

geraldlee
Автор

Just finished the whole series. Thank you so much Philipp for the hard work! Much appreciated

pickleali
Автор

One thing i love about your presentation is you always call out keyboard shortcuts. I have seen developers with 5 years experience still using manual mouse pointer for everything

the_nomadic_ajith
Автор

Great playlist, came here after seeing you on Traversy media, really appreciate your videos. keep it up! :)

MrLunaable
Автор

finally completed kotlin now can start android dev with kotlin let's see how it goes
thank you for this amazing course

Luffy_
Автор

Great Tutorial Bro! I have watched all your videos from the beginning till the end. Thank you Philipp because of you I already know the basics of Kotlin!

daiyrkanybekov
Автор

Thanks for great playlist. Now I'm good with kotlin basics and I'm heading to Kotlin Android tutorials. Keep continuing and wish you all the best .Love from India❤

nithinrupireddy