Duration: 16:17 minutes
Summary: In this video, we continue our discussion on generics and collections. Specifically, we will tackle the wild card (?). In some programming scenarios you might see yourself creating similar methods that act on different types (a sum method that adds integers, another one that adds doubles…). To avoid code duplication, you can use the wild card. Here, I will show you how you can create two ArrayLists (one for Integers and another one for Doubles). These ArrayLists are populated from arrays. Then, we will write a single method that sums integers and doubles using the wild card (?). This method will operate on any type that extends Number.