Generic Methods/Functions

Generics help to write reusable code. Generics for classes and methods help enable reusing the same code for different implementations of data types. Explore the details in this lesson.

We'll cover the following

Generic Methods/Functions

Let’s build upon the products and store we discussed in the last lesson. Define a new method lastItem() which takes the list of products and returns the last item on the list.

Get hands-on with 1200+ tech skills courses.