Bridge Methods

This lesson explains bridge methods created by the compiler when working with generics.

We'll cover the following...

Question # 1

What are bridge methods?

Bridge methods are synthetic methods created by the compiler as part of the erasure process when compiling a class or interface that extends a parameterized class or implements a parameterized interface. To understand bridge methods, let's try to understand the problem that bridge methods solve. Consider the following setup, where the class purposelessClass implements the generic ...