Advanced Features in Java: Using Generic Type Parameters

Expected Duration
Lesson Objectives
Course Number
Expertise Level


In this course, you'll learn how type parameters can be used to combine type safety and code re-use. You'll see how type parameters can be specified for either for classes or for individual methods of classes. You'll learn that while instantiating objects of those classes, or while invoking those methods, you can pencil in type arguments in place of those type parameters. You'll cover defining type parameters, using classes and methods with type parameters, as well as conventions and rules that apply to such parameters. You'll then explore the raw type that lies beneath any class or method with a type parameter. Java creates just one single copy of such code, and pencils in a type parameter of java.lang.Object. Java also adds various type checks to ensure that the code is used correctly - this is known as type erasure, and forms the basis of the great performance of Java generics. Finally, you'll move on to the use of constraints on type parameters and see how these are achieved using Bounded Type Parameters. Using bounds, it is possible to exercise fine-grained control over the ensure that the type argument - for instance to specify that it must be a numeric type.

Expected Duration (hours)

Lesson Objectives

Advanced Features in Java: Using Generic Type Parameters

  • discover the key concepts covered in this course
  • recognize how using type parameters can ensure both type safety and code reuse
  • recognize different aspects of specifying and using type parameters
  • describe the raw type underlying a generic type, and how if no type parameter is specified, Java makes the object of type java.lang.Object the type parameter
  • recognize that the names of type parameters don’t matter so long as certain variable naming rules are not violated
  • iterate over objects that have multiple type parameters
  • recognize how type parameters can be applied not only to classes, but also to specific methods inside classes
  • describe the use of type parameters within functions
  • describe the use of more than one type parameter
  • incorporate constraints, known as bounds, on type parameters
  • differentiate between bounded and unbounded type parameters
  • summarize the key concepts covered in this course
  • Course Number:

    Expertise Level