Generics#
Generics let you write reusable code that works with multiple types while preserving type safety. Instead of using any, generics capture the actual type passed in and carry it through the function, class, or interface.
Generic Functions
Functions that work with any type while preserving type info
Generics capture and preserve types through function calls