☕Want to master Java? Get my complete Java course: bit.ly/42mQlXE
@KnakuanaRka4 жыл бұрын
Also, something else to add about generics: If you’re expecting some specific property of the class you put into a generic, you can write that into your generic. For example, if your class had an array of T’s that you wanted to sort, just putting MyClass will make your compiler complain that you’re doing something unsafe. This is because you can only use sort() on the array if the class T implements the Comparable interface and its compareTo() method, and there’s no guarantee someone won’t try to make it with some class Java doesn’t know how to compare or sort (like a custom one). The solution here? Write your class header as MyClass. This tells the compiler that you will only make MyClass’es with types that can be sorted. This uses “extends” as opposed to the “implements” usually used for interfaces because you’re just making a promise about the generic class, not actually implementing one, and the second T is because Comparable is also generic (so you need to say that T implements a method to compare T objects specifically).
@eustachybakielka4 жыл бұрын
It's not because of reification of arrays?
@KnakuanaRka4 жыл бұрын
@@eustachybakielka Not sure what you’re referring to.
@eustachybakielka4 жыл бұрын
@@KnakuanaRka "For example, if your class had an array of T’s that you wanted to sort, just putting MyClass will make your compiler complain that you’re doing something unsafe"
@KnakuanaRka4 жыл бұрын
@@eustachybakielka What the heck is reification of arrays?
@eustachybakielka4 жыл бұрын
@@KnakuanaRka What is reification in Java? In the context of Java as a programming language, reification is the process by which a user program or any aspect of a programming language that was implicit in the translated program and the run-time system, are expressed in the language itself. In Java, there exist "reifiable types" that are "completely available at run time" (i.e. their information is not erased during compilation). Example: //Allocates an array of type String, so it is reified String[] aStringArray = new String[10]; //Allocates a list with no type, Java does not reify generic types List aStringList = new ArrayList();
@lindawisebear4 жыл бұрын
This is the best explanation of Generics I've seen on the internet. I loved how you started with the problem to solve, and then showed how generics is useful when tackling that problem :)
@999loaderu3 жыл бұрын
true dat. Fell the same
@gauravmishra87822 жыл бұрын
True
@philippebaillargeon52044 жыл бұрын
I like the way you explain things: Java developers created Generics to solve a problem, so I think its pretty logical to talk about the problem before talking about the concepts that were created to solve it. Great video !
@mastershonobi1103 жыл бұрын
Super great point(illustrate the problem to solve, before the concept). A lot of Java Channels should be taking notes!!
@angledcoathanger2 жыл бұрын
Totally agree - it's hard to get excited about a key if you haven't seen the lock that it opens
@TS-wj4im3 жыл бұрын
Dude thank you. My text book way over complicated generics. Now it all makes sense.
@abdullahmajed75544 жыл бұрын
that was really simple i love the way you edit the video making switch between you and the code it feels so clean, thank you
@deeptimonga73754 жыл бұрын
Keep On Making such videos on Keep On Coding channel. Really Helpful !!
@KeepOnCoding4 жыл бұрын
Thanks for watching Deepti!
@dalvandi4 жыл бұрын
Possibly one of the best, clearest, and crispest explanations on the generic class that I've seen! Keep up the great content dude!
@ramiayash76583 жыл бұрын
i highly agree with you, the guy is so clear with his explanations
@shagiwan2 жыл бұрын
Second year of studying Software Development in Uni and this is just the best explanation ive heard! Great job man!
@IgorBeneli10144 жыл бұрын
You're incredible you explained with 12min a concept that my professor couldn't do it with 1 hour. Keep doing this amazing job thank you so much!
@JosephGallagher Жыл бұрын
This is the most concise and easy to understand video I've seen so far on Generics, thank you so much :D
@conea68913 жыл бұрын
I like this fast paced explanation.
@mohannadfadhal42823 жыл бұрын
Thank you so much, Sir. You made the explanation for generics very simplified, especially, by the style of starting with the problem first and then showing the solution! 🤩
@himanshushukla7873 жыл бұрын
bro your java playlist is so underrated. I love it
@philyeo3 жыл бұрын
awesome stuff. I liked the way you explained it - showing the problem first and how generics can help save the day!
@delmayank3 жыл бұрын
Lounge Coding! I really liked the theme. A new touch to coding tutorials. I am your fan now. You rock! Oh! And the stuff that you covered in this tutorial is of great value. You explained it easily and flawlessly.
@fredericoamigo2 жыл бұрын
Thank you so much for this! I love your Java tutorials. So simple, clean and explanatory. Keep up the good work!
@anx007d3 жыл бұрын
Thank You very much .. after looking many videos from different sources ....... this video absolutely cleared my thoughts for Java Generics.
@tarunkaushik3202 ай бұрын
Very well! Nice explanation of usages of Generic types, and Wildcards.👌(helps in understanding the difference between them and their significance)
@lazpz6172 жыл бұрын
This video really helped me understand Generics way more than my instructors classes
3 жыл бұрын
Wow! You explained it all so good. I finally feel like I understand this. Thank you so much. Please keep it coming.
@chinemelumj53492 жыл бұрын
Finally understood generics, thank you so much!.
@hannahc84362 жыл бұрын
This was such a great explanation of Generics. I've been so confused about it for the past few weeks. Thank you!!
@BoetFly4 жыл бұрын
Man, thank you so much, i finally understand those generics now :D
@wovasteengova4 жыл бұрын
This looks like it's from java, a beginner's guide. I too was confused on what generics fix but thank you for explaining it in the beginning of the video. I think you should do that to all your videos
@SaljooqAltaf4 жыл бұрын
This just might be personal preference but the best and most detailed explanations for anyone studying comp sci are found in this channel - no idea why views haven't hit a million
@shreypatel93794 жыл бұрын
This was the best explanation on youtube, short and concise. Thank you and keep making such videos
@alexmedina51354 жыл бұрын
what a good, easy, and elegant way to explain generics ... keep it up!!
@ziekaman24503 жыл бұрын
Thankyou so much. You're very talented in explaining complicated Java thingys!
@gauravkumarsingh6404 жыл бұрын
This is legit the best video I could find to understand Generics!
@AshBeastreal2 жыл бұрын
Wow this is one of the best explainer videos. Loved watching it🤩
@19sunheart963 жыл бұрын
Nice video! Very easy to understand explanation of the concept.
@PrakashVl4 жыл бұрын
This tutorial is helpful for filling the gaps in generics, thanks for explaining thoroughly.
@prabhakarlal47994 жыл бұрын
Nice and simplified explanation of a complicated topic. Thank you.
@ravenmadd13433 жыл бұрын
Why can't everything be explained this clearly and quickly? Thanks for doing this and keep up the good work.
@101matthias4 жыл бұрын
I just watched 9 hours of online classes from my teacher on generics and I understood nothing. Less than nothing. 10 minutes of you and everything is clear it's super easy actually.
@technocoh2 жыл бұрын
yeah not every professional or teacher is able to share his knowledge the proper way... ;)
@pinolskun87642 жыл бұрын
@@technocoh yeah if someone need 9 hours to explain a concept you can safely assume they are the first who don't understand it
@earl0fBronze4 жыл бұрын
I read a thirty page chapter on this, one ear out the other. This video is outstanding, mind blown.
@abdullahmoiz81514 жыл бұрын
Man this was a fantastic explanation I particularly liked how you first showed what the problem was then showed how generics solve it
@leeamraa7 ай бұрын
correction: you should make this function type-bounded as well, like this --> "boolean absEqual(NumericFns
@athardaif4 жыл бұрын
I was struggeling with understanding generics until I watched your video. Thanks a lot :)
@KeepOnCoding4 жыл бұрын
Have you ever used Generics in your code?
@Jilnn4 жыл бұрын
nope
@Chaz-LeeP4 жыл бұрын
yea! coming from c++, i was taught that its called templates
@ActualVital4 жыл бұрын
Yup. My Data Structures professor would always require us to use them. Still don’t understand them. Hopefully this video will help me understand!
@guitarman8134 жыл бұрын
Yes, in my latest Java project. While they seem easy in theory, implementing them is another matter! I hope to gain knowledge from this video and other sources and thus strengthening my performance in this area.
@rossocorsa65774 жыл бұрын
Keep On Coding Yee for my assigment
@ledtargaouschi58314 жыл бұрын
Your videos are very helpful and your teaching methods are very clear
@shecodesthings39784 жыл бұрын
Ah, another example of my previous compsci professors failing to teach something fairly straightforward... *facepalm* You, on the other hand, taught it in such a practical and applicable manner: Discuss a simple problem and then propose a solution (and actually working through the example) Super easy to remember too. Great video!
@kaifahsan84594 жыл бұрын
Thanks for the video mate. Pretty well explained. Would be awesome if you keep making videos about core and advanced OOP concepts like this.
@KeepOnCoding4 жыл бұрын
Thank you sir. Did you have a specific topic in mind?
@kaifahsan84594 жыл бұрын
Probably topics like interfaces, polymorphism, exceptions, collection frameworks etc. There's a huge Quora thread that might help you as well: www.quora.com/What-is-a-complete-list-of-topics-of-Core-Java-and-topics-of-Advanced-Java
@KeepOnCoding4 жыл бұрын
Awesome! Thanks!
@youvegotmail93852 жыл бұрын
Not sure why it's still taking me a minute to wrap my head around Generics. I'm sure it'll click, but it's so funky to me even with your great explanation.
@isah.29803 жыл бұрын
Thank you so much! Please, keep doing videos like this!
@abhijeetmokale90244 жыл бұрын
Seriously this way of learning from the problem is amazing! Thanks Sir!!
@nyangnyangliz4 жыл бұрын
Thank you for this quick video. You saved me 30 minutes of reading long paragraphs from my lecturers.
@CarlosRamirez-uz7hs3 жыл бұрын
Great video man, keep doing what you do
@davidxdhloqud2 жыл бұрын
I'm spanish speaker, your videos are sooo good than I can understand, thank you
@leonrickert40614 жыл бұрын
Keep on man, cool teaching style
@quikel70452 жыл бұрын
Watched 2 videos, had it at uni, read documentation and still didn't understand why Wildcards are useful. You basically explained it in 2min with a simple example. Thank you very much.
@fahadtahir64 жыл бұрын
Very informative and loved your communication style
@zachhewitt43284 жыл бұрын
10/10 man! Keep it up. It's better than my current professor!
@KeepOnCoding4 жыл бұрын
Lol glad it helped!
@tolstoievski49263 жыл бұрын
You can also declare generic type at method scope id you're planning to use static methods (methods that are not requiring you to instantiate class to use it)
@sheriffcrandy4 жыл бұрын
You seem like just a solid dude haha thanks for the help man!
@anithachowdary97164 жыл бұрын
I understood the topic very well.Thank you so much Please share more videos
@monetoast4 жыл бұрын
Exceptional video, very clear!
@saintfrancisbeats96394 жыл бұрын
Dope! I am currently in an Intermediate Programming college course and they just want us to read a document. I was so lost. This clarified alot. Also it cause me to switch from Netbeans to IntelliJ IDEA hahaha
@tetsuorulin90093 жыл бұрын
I love teaching to the problem. Great video and thanks!
@pratikthorat34803 жыл бұрын
I know what generics are but I still feel I learnt a few new things here. God Dayummm you are awesome.
@2010aishwary4 жыл бұрын
very nice to the point video, subbed
@qwarlockz80173 жыл бұрын
Nice video. You do have a great way of explaining things.
@89pravinb3 жыл бұрын
Thank you for creating this video! Very concise and informative
@faikyesilyaprak87614 жыл бұрын
That was lit bro!!!! Thanks for crystal clear explanation :))))
@premalupadhyay35553 жыл бұрын
Great and simple explanation, I like this way of teaching a lot.
@liaskarllate4 жыл бұрын
WOW' You're good at teaching code and concepts. Way to go!
@lurkhidden91264 жыл бұрын
Learned hella! Good looks my guy
@RubenGarciaCS3 жыл бұрын
Excellent quality! Thank you
@morolillyshean88162 жыл бұрын
Yes, this is the best one I found. Thanks!
@aavocadoToast3 жыл бұрын
Great video! Detailed and to the point.
@kylemanley9154 жыл бұрын
Sweet tutorial, just subscribed
@ritexcorp2 жыл бұрын
That was a great explanation of Generics, keep up the good work, I just subscribed to your channel. Do you have something on Java annotations?
@MrDoctorSchultz4 жыл бұрын
Smooth, informative, and straight to the point. Keep up the good work!
@olegc62094 жыл бұрын
Awesome explanation, thanks for your help!
@TKollaKid3 жыл бұрын
Great explanation - clear and helpful. Thank you.
@damyandimitrov6114 жыл бұрын
Very well explanation and approach
@AlbatraozProductions3 жыл бұрын
Great video! If I can be a bit nitpicky, you should call "functions" by their real Java name, "methods". I know this is a really small detail, but since many people who watch these kind of videos might be pretty new to Java, it can help prevent confusion.
@mattrazol4 жыл бұрын
Hello there! In the last example.. what about if, instead of using the question mark (therefore a generic object), you declare another generic type (let's say V) that also extends Number? Something like this: boolean absEqual(NumericFns num) { ... } Therefore you can ensure that for example a string (or any other object that doesn't extend Number) wont be passed, and potentially break your code? I'd be glad to hear your opinion on it. 😃
@gaspartomi9714 жыл бұрын
Late answer, but here it is! What you suggest is unnecessary, since the class NumericFns can only be constructed with a number class argument anyways. So that parameter has a ? as argument, thats true, but it is impossible for that ? to not be a number (NumericFns constructor wont allow it).
@ItsTheDannyShow4 жыл бұрын
Subscribing man. You helped so much.
@chikken0074 жыл бұрын
Great explanation! Just gained a new Sub. Thank you and keep it up please!
@donwinston6 ай бұрын
You didn't cover generic methods and the parameter type lists before the returned type in a method definition. I've been using generics for years and just learned this today! Don't have to use this when you're just a consumer of generic classes.
@furioustodd51054 жыл бұрын
I have always found Generics a hard topic. Your explanation with code was great. Huge thumbs up 👍🏻
@999loaderu3 жыл бұрын
really well explained m8. Appreciate it. thx
@leslyp.blaise72383 жыл бұрын
Explanation clear and concise thank you
@kalyanmatamarugu93964 жыл бұрын
Clean, simple and perfect content!
@kennethfrederickx3 жыл бұрын
wish my teacher knew how to explain this like u, great video
@bibahbibah51083 жыл бұрын
i like the u develop the subject, uake java very easy to work with
@lancelotlin34594 жыл бұрын
Best tutorial! Thanks for your explanation!
@jschlln2063 жыл бұрын
Am I the only one who's confused as to why a generic number class defaulted to requiring an integer (11:08)? Great video, as usual!
@xxanton8xx4 жыл бұрын
You look like you're gonna fall asleep the next second, but you explained the topic very well!
@GeorgeKonstantinou-v2i3 жыл бұрын
well thank you for explaining to me what i didn't learn from the class.
@nisarullah77343 жыл бұрын
Great work keep it up
@dablo8984 жыл бұрын
Thank you, I learnt something new today
@Laa_2 жыл бұрын
Hello, thank you for tutorial, it helped me a lot about generics. But I have a question. On 10:50 you said num will always have to be an integer. Question is simple. Why? I thought num is data type of T and T is extending numbers so it can be an integer as well as a double and so on. Thank you in advance :)
@himangshuchowdhary43692 жыл бұрын
Great explanation KOC!
@Burak-cr6um2 жыл бұрын
Thank you, It was very helpful as usual.
@temps19593 жыл бұрын
11:17 would it be better practice to say ‘(NumericFns
@wesNeill3 жыл бұрын
Lol @ the smooth jazz in the background. But good content!
@MrMarkjams4 жыл бұрын
This is a great video! Could you do one on Interfaces?