Java’s powerful generics has been available to developers for ten years now and is extensively used throughout both core and third party libraries. Unfortunately, it's not as well understood as it could be. This course is here to help. We’ll both shine a light on the common use cases of generics on classes, methods, or interfaces and also peer into some of the darker corners such as type bounds and wildcards.
Wildcards Hi, Richard Warburton here. This module, module number five, is about wildcards. Now, as we briefly mentioned towards the end of the previous module, wildcards are used extensively throughout the Java core libraries. In fact, wildcards are wherever you see one of those question marks inside your generics. If you ever see a generic type parameter and you see a question mark, that's a wildcard. In this module, we're going to explain what they are, how you might use them, what the different types of wildcard are, and why you might use them. Really, wildcards aren't just one feature in and of themselves. It's a name given to a collection of different capabilities that we have with generics. It's all to do with bounds. Wildcards can be bounded or they can be unbounded. What a bounded wildcard is, is it's where you see something with list question mark extends class name, or list of question mark super class name, and those are upper and lower bounded wildcards. If you just say something like list of question mark or class of question mark, that's an unbounded wildcard. We're gonna have a look through in this module, and we're gonna cover all three different types of wildcards and we're gonna say what they can be used for as well.