Overview

We will be dealing with a lot of collections in this class, like lists, which need to store objects of any particular type. Since Java is particular about the type of objects, we will need to use a concept called a generic to define our own collections and work with the Java built-in collections. Today’s class is focused on diving into that weird <> syntax that you’ve been seeing and exploring the idea of generics.

Basic Learning Objectives

Before class, you should be able to:

  • Explain why generics are necessary in Java
  • Explain what a HashMap is and what it can be used for

Advanced Learning Objectives

After class, you should be able to:

  • Write a container class using a generic
  • Use Java built-in container classes with generics
  • Use HashMap to solve a problem

Readings

You should read the following from the book Problem Solving with Algorithms and Data Structures using Java:

Checks

Complete the reading check quiz on Moodle.