How to use Java generics to avoid ClassCastExceptions
Briefly