+ 2

My understanding of generics is that you can avoid over using function overloading.

Generics helps me write cleaner code

6th Oct 2016, 9:48 AM
Abdul Meyer
Abdul Meyer - avatar
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.
9th Oct 2016, 5:01 AM
Ivan G
Ivan G - avatar
+ 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.
6th Nov 2016, 3:50 PM
Michael Dolence
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.
9th Nov 2016, 8:39 PM
Ivan G
Ivan G - avatar