Premium Only Content

Java Generics
Java Generics enable us to gain type safety in situations where classes and methods that are designed to be able to work with any type would otherwise be designed to work with Object instances. For instance, without Java Generics the Java List, Java Set, Java Map etc. interfaces would all be working on Object instances. With Java Generics you can create List, Set or Map instances that work on specific types, e.g. a List of Strings, rather than a List of Objects, so you achieve a higher type safety in your code.
Java Generics add type parameters to classes, interfaces, methods and variables that decide to use them. To be able to use a type parameter with a class, interface, method or variable the type you are trying to add the type parameter to, must be designed to allow generic type parameters.
Many of Java's built-in utility classes and interfaces are designed to allow generic type parameters. This Java Generics tutorial shows examples of how to use generic type parameters with some of these classes. Once you have seen a few examples, you can figure out how to use generic type parameters in general.
You can also design your own classes, interfaces and methods to use usable with Java Generics - meaning enabling them to take type parameters. This Java Generics tutorial also shows how to do that.
Chapters:
0:00 Java Generics Introduction
0:24 Java Generics Example
8:32 Java For Each Loop Using Generics
9:37 Java Collections Support Generics
11:19 Java Generics in Your Own Classes (Method Level)
14:57 Java Generics in Your Own Classes (Class Level)
20:47 Java Generics in Your Own Classes (Field Level)
24:20 Class Objects as Generic Type Literals
28:15 Java Generics in Your Own Interfaces
34:39 Java Generic Wildcards
36:50 Java Generic Wildcards ?
40:59 Java Generic Wildcards ? extends SomeClass
44:57 Java Generic Wildcards ? super SomeClass
X (Twitter): @jjenkov
LinkedIn: https://www.linkedin.com/in/jakob-jenkov-4a3a8/
Java Generic Tutorial - text:
https://jenkov.com/tutorials/java-generics/index.html
-
2:00:48
The Charlie Kirk Show
3 hours agoTHOUGHTCRIME Ep. 97 — The Thoughtcrime WILL Continue
97.8K77 -
35:08
Colion Noir
9 hours agoA Bear, an AR-15, and a Home Invasion
20.5K3 -
3:05:55
TimcastIRL
5 hours agoJimmy Kimmel Refuses To Apologize Over Charlie Kirk Comments, Blames Gun Violence | Timcast IRL
165K128 -
2:44:24
Laura Loomer
7 hours agoEP144: Trump Cracks Down On Radical Left Terror Cells
37.8K10 -
LIVE
Drew Hernandez
10 hours agoLEFTISTS UNITE TO DEFEND KIMMEL & ANTIFA TO BE DESIGNATED TERRORISTS BY TRUMP
991 watching -
1:12:32
The Charlie Kirk Show
5 hours agoTPUSA AT CSU CANDLELIGHT VIGIL
81.2K57 -
6:53:45
Akademiks
8 hours agoCardi B is Pregnant! WERE IS WHAM????? Charlie Kirk fallout. Bro did D4VID MURK A 16 YR OLD GIRL?
51.7K6 -
2:26:15
Barry Cunningham
6 hours agoPRESIDENT TRUMP HAS 2 INTERVIEWS | AND MORE PROOF THE GAME HAS CHANGED!
119K82 -
1:20:27
Glenn Greenwald
7 hours agoLee Fang Answers Your Questions on Charlie Kirk Assassination Fallout; Hate Speech Crackdowns, and More; Plus: "Why Superhuman AI Would Kill Us All" With Author Nate Soares | SYSTEM UPDATE #518
108K33 -
1:03:06
BonginoReport
8 hours agoLyin’ Jimmy Kimmel Faces The Music - Nightly Scroll w/ Hayley Caronia (Ep.137)
162K64