+ 2
My understanding of generics is that you can avoid over using function overloading.
Generics helps me write cleaner code
3 Respuestas
+ 1
Generics also improve your application execution speed because you don't need box and unbox your objects everytime. For every generic code compiler creates different code for each type with which it used, so you have no boxing-unboxing operations here.
+ 1
Generics allow you to write less code by changing input and return types in a class while maintaining strong typing.
Boxing and unboxing have to do with type conversion and moving objects from the stack to the heap and back.
0
@Michael if you compare ArrayList vs List of value type, then you have boxing/unboxing, so yes, it happens not in every use case.