What is Generics?
Generics is one type of facility of the generic programming and in 2004, it was added to the Java programming language in the java official release version J2SE 5.0
In 1998, Gilad Bracha, David Stoutamire, Martin Odersky and Philip Wadler created Generic Java as an extension to the Java language to support generic types. Generic Java was merged in Java with the addition of wildcards.
In any software engineers’ life, bugs are always a simply part of everyday life. Though any software engineer always tries to work carefully and most of the bugs are removed at primary level. In spite of careful planning and coding, unfortunately somehow and somewhere, there is some bugs in our code. Normally it occurs as new features are coming every day and so our code base raises in size and complexities.
Luckily, some bugs (like Compile-time bugs) are easier to detect than others. To identify the problems and fix it, we can use the compiler’s error message right then and there.
It is obvious that runtime bugs is always much more problematic than others; they don’t always outward instantly, but whenever they do, we are far away from the actual cause of the problem.
To solve such type problems, Generics is a positive element and it adds stability to our code and produces more of our bugs detectable at compile time.