Domanda di colloquio di Morgan Stanley

What are generics?

Risposta di colloquio

Anonimo

12 set 2017

Generics help represent the type that is contained in a container class like List or Map so that the compiler can infer type information and provide compile time checks. It also helps remove type casting boilerplate. I gave example code with both generics and non generics syntax to highlight the difference