First page Back Continue Last page Overview Graphics
Generics – nightmare
It is not nightmare, but we have to learn it.
static List<List<? extends Shape>> history
public static <T, S extends T> void copy(List<T> dest, List<S> src){...}
public <T extends E> boolean addAll(Collection<T> c);
public static <T extends Comparable<? super T>>
Notes:
Any time you can
─ Unless you need to run on pre-5.0 VM
• The extra effort in generifying code is worth it!
─ Increased clarity and type safety