Generics let you write classes and methods parameterized by type, so the same code works with many types while keeping compile-time type safety. This is parametric polymorphism — "one shape, any type."
The problem they solve
java
();
list.add();
(String) list.get();
