Generics imposes type checking compile-time checks, but writes bytecode that works with objects. That way, List is a List<String> when the code runs, but you are not allowed to use list.add(new Date(...)) because the compiler will refuse your neglect of a generic type.
As a result of running a list as a list under covers, Generics does not have any performance benefit or performance penalty over unrelated common data structures.
source share