JAVA GENERICS – BASIC USAGE

Generics is an important feature of Java which was introduced in the version 1.5. Generics allows us to create generalized collections and provides a way of type safety at compile time. Generalized collections means any collection from java.util package which only accepts a particular type. For example, an ArrayList of String objects can be considered as a generalized list. With the help of Generics, we can ensure that our ArrayListor of any other collection only accepts any specific type of objects. This safety check is done at compile time. Before the introduction of Generics (Java 1.4 and previous versions), developers […]

JAVA GENERICS – BASIC USAGE Read More »