Kotlin Generics Explained with Example

Поділитися
Вставка
  • Опубліковано 23 лип 2024
  • In this video "Kotlin Generics Explained" we will learn about generics in Kotlin. Generic is a powerful feature of any object oriented programming and using it we can define classes or functions that can work with different data types.
    0:00 Introduction?
    0:20 Kotlin Generics, Why?
    4:20 Kotlin Generics Explained
    7:38 Generic Function
    8:42 Multiple Typed Parameters
    If you are having difficulties navigating from one lesson to another, then click on this link and it will open the complete playlist of this Kotlin Object Oriented Programming. In this playlist all lessons are already arranged in chronological order.
    👉 bit.ly/3lMLtpj
    All the codes about this Kotlin Android Tutorial for Beginners are organized sequentially in this repository
    👉 bit.ly/2UoyiQf
    And if you need more support, then you can join the Simplified Coding’s Quora Space to post your questions.
    👉 www.quora.com/q/simplifiedcoding
    If you want to get in touch with me; you can find my contact details here:
    👉 www.simplifiedcoding.net/about/
    Finally, If you love my content please SHARE my courses to your friends. You can share this course to your Facebook, WhatsApp etc.
    For more contents related to Software Development visit my website.
    👉 www.simplifiedcoding.net
    You can SUPPORT me if you want
    👉 Patreon: / belalkhan
    👉 UPI (India Only): probelalkhan@okaxis
    👉 PayTM (India Only): +917549161079
    👉 PayPal: www.paypal.me/probelalkhan
    You can also check some of my other courses from these links
    👉 Android MVVM Tutorial: bit.ly/3iLfVzu
    👉 Android Game Development Tutorial: bit.ly/38JmltC
    👉 Retrofit Android Tutorial: bit.ly/2DEwAl1
    👉 Android RecyclerView Tutorial: bit.ly/2TqVjPz
    👉 Android Room Tutorial: bit.ly/2PfQHeN
    👉 Firebase Auth Tutorial: bit.ly/2WUGhEo
    👉 Android Notification Tutorial: bit.ly/2Sc6jQl
    👉 Building a Complete Wallpaper App: bit.ly/30UN8zV
    👉 Build Tic Tac Toe in Android: bit.ly/30goxW0
    ❤️❤️ Thank You All for the Love and Support ❤️❤️
    #KotlinOOP
    #OOPsConcept
    #LearnKotlin
  • Наука та технологія

КОМЕНТАРІ • 34

  • @FemiOkedey
    @FemiOkedey 2 роки тому +12

    For the first time, I really understand generics. Thanks a lot

  • @janadonis5211
    @janadonis5211 2 роки тому

    What a great teacher! keep up the good work, thanks a lot man!

  • @nishu33389
    @nishu33389 3 роки тому +1

    Thanks Belal for the kotlin tutorial series 😃🙏

  • @DSW2022
    @DSW2022 Рік тому

    You are a brilliant teacher Bilal. Thanks to you now I understand generics.

  • @kevgits
    @kevgits Рік тому

    I couldn't understand this concept even after going through the docs. Thank you for this simplified version.

  • @vengateshm2122
    @vengateshm2122 3 роки тому +8

    Add a video on covariance, contrravariance, invariant.

  • @Sumitmaurya070
    @Sumitmaurya070 3 роки тому +1

    very good feature of kotlin. Thanks for the info,

  • @GriNAME
    @GriNAME 2 роки тому +1

    Thank you so much! Your vidios are so useful for me (and for other I guess). You made my coding live more better, I mean it! With love from Russian 💪👍

  • @techmarinar
    @techmarinar 2 роки тому

    Thanx man this was very helpful 😊

  • @kpranjith
    @kpranjith 2 роки тому

    wow great explanation with example!!! 😍

  • @shreyashchoudhary7413
    @shreyashchoudhary7413 3 роки тому

    Loved it!

  • @gilong1311
    @gilong1311 2 роки тому +1

    Great video, do you have a video on usage of covariance and contravariance?

  • @decloudius
    @decloudius 2 роки тому

    I don't know how to tell you my gratitude but, I love you sir, thank you

  • @jkeriatamboli2101
    @jkeriatamboli2101 3 роки тому

    As in java for we compair int value using == like 1==1 but for string we compair using equals() like str1.equals(str2) so in kotlin for string == work

  • @spy9789
    @spy9789 2 роки тому

    Thank you master

  • @nocompromise8264
    @nocompromise8264 3 роки тому

    How to upload .db file (Of SQLite Database) to user's Google Drive?, in Kotlin?

  • @positive_vibes_alone
    @positive_vibes_alone 2 роки тому

    How can we achieve the same using pojo class as T ?

  • @kristianabrahamsen7019
    @kristianabrahamsen7019 2 роки тому

    good explanations!

  • @IUfidi
    @IUfidi 2 роки тому

    I like ur style!

  • @johndominicjasmin
    @johndominicjasmin 3 роки тому

    Thank you

  • @user-nh9ih4mj8i
    @user-nh9ih4mj8i 2 роки тому

    good examples

  • @MisterWealth
    @MisterWealth 2 роки тому

    Are generics for beginners intermediate or pros? Because this seems like a difficult concept to grasp for me :(

  • @milon27
    @milon27 3 роки тому +2

    When to use & when only

    • @SimplifiedCoding
      @SimplifiedCoding  3 роки тому +2

      In very simple words
      When you make your T out you can only define it as return type in function if you try to write it as a parameter you will get error.

    • @SimplifiedCoding
      @SimplifiedCoding  3 роки тому +2

      For more details you can search
      Covariance, Invariance and Contravariance

    • @milon27
      @milon27 3 роки тому

      @@SimplifiedCoding thanks

  • @vengateshm2122
    @vengateshm2122 3 роки тому +1

    Can we use Any instead T ?
    Because Any is the class which is extended by all classes in default?

    • @SimplifiedCoding
      @SimplifiedCoding  3 роки тому +4

      When you write T or any character; it basically means any. Here you cannot define the actual type not even any.
      Any is there by default. It means T : Any that is you can define any type that inherits Any and Any is the super type of all classes.
      You can also restrict by defining a specific parent for example T : View
      It means here for T we can define any type that is a View.
      So you cannot write the class name here. But you can define a super type if required.

    • @vengateshm2122
      @vengateshm2122 3 роки тому

      @@SimplifiedCoding Thank you Belal

  • @mdjahidulislam9205
    @mdjahidulislam9205 3 роки тому +1

    Covariance and Contravariance what about this?

  • @brahmadathv3593
    @brahmadathv3593 3 роки тому

    nice manh

  • @ampo2004
    @ampo2004 3 роки тому +1

    360p ? : ( too blurry

    • @SimplifiedCoding
      @SimplifiedCoding  3 роки тому

      UA-cam is processing the HD version, wait for a while, it will become Full HD.

  • @KikeonR
    @KikeonR 3 роки тому +1

    Is it helpful