4- Generic Classes

4:27 3 & Kefluniañ 2 Pennadoù 105 reter

Pennadoù

  1. 0:03

    Let's see how generics prevent the problems we discussed earlier. So, let's add a new class in this package. We call this generic list to differentiate from the other list implementation. Now we want this class to be generic so we can reuse…

  2. 2:42

    Finally, we need our get method, so public t get integer index. Again, instead of an integer or an object, we return t. So here we return items of index. Now, back to our main class, when we create a generic list of integer and call the add…