Generics have been in Java since version 5. What are the performance implications of using generics in a Java application and can you explain the reasons for their performance impact?
Generics have been in Java since version 5. What are the performance implications of
Share
Generics is a compile time feature. It has next to no impact when running your application.
Like most performance questions; it is far more important to write clear and simple code and this is often gives very good performance.
Changing your design for performance reasons is a so often a mistake some people say you should never do it. I think it is worth considering performance before you start but you have to recognise when you have a relatively trivial performance question.
You are better off writing your code and optimising it later when you have a better understanding of how you application behaves. i.e. when you are real use cases and a profiler.