Java Tutorials - Herong's Tutorial Examples - Version 7.03, by Dr. Herong Yang
Wildcard Parameterized Types
This section describes wildcard parameterized types where a argument type contains the wildcard character '?' and represents a group of types instead of a single type.
What Is a Wildcard Parameterized Type? A wildcard parameterized type is a parameterized type of a generic class or interface, where the argument type represents a group of types, instead of a single type.
The objective of using a wildcard parameterized type is to create a new parameterized type that is wider than a normal parameterized type, so that you can use it a supertype of the normal parameterized type. Here is some examples of wildcard parameterized type:
java.util.List<?> a; java.util.List<? extends Number> b; java.util.List<? extends Integer> c; java.util.List<? super Integer> d;
Wildcard parameterized types can be divided into 3 groups:
The diagram below shows you some examples of supertype-subtype relationships of wildcard parameterized types and parameterized types:
Last update: 2014.
Table of Contents
Execution Process, Entry Point, Input and Output
Primitive Data Types and Literals
Bits, Bytes, Bitwise and Shift Operations
Managing Bit Strings in Byte Arrays
Reference Data Types and Variables
StringBuffer - The String Buffer Class
System Properties and Runtime Object Methods
►Generic Classes and Parameterized Types
Using a Generic Class - Example
Creating a Generic Class - Example
Raw Type, Generic Type and Parameterized Type
Parameterized Type and Subtyping
Wildcard Parameterized Type Test
Wildcard Parameterized Subtyping
Wildcard Parameterized Subtyping Example
Generic Methods and Type Inference
Lambda Expressions and Method References
Execution Threads and Multi-Threading Java Programs
ThreadGroup Class and "system" ThreadGroup Tree
Synchronization Technique and Synchronized Code Blocks
Deadlock Condition Example Programs