Generics in Java

Generics is a technical term for a set of language properties that allow generic types and methods to be defined and used. Generic types or methods differ from ordinary types in that they have typed parameters.

An example of using generic types is the Java Collection Framework. For example, the LinkedList<E> class is a typical generic type. It contains the parameter E, which represents the type of items that will be stored in the collection. Objects of generic types are created by replacing parameterized types with real data types. Instead of just using LinkedList, without saying anything about the type of the item in the list, it is suggested to use the exact type indication LinkedList<String>, LinkedList<Integer>, etc.


Read also:


Comments

Popular posts from this blog

Methods for reading XML in Java

XML, well-formed XML and valid XML

ArrayList and LinkedList in Java, memory usage and speed