I had read about type erasure in Java a long time back. However, today when a friend asked me a question related to type erasure, I found myself not quite certain of the answer. I read up on it again and here is what I learned. Angelika Langer has an excellent FAQ , where she explains generics, and type erasure. According to the FAQ: A process that maps a parameterized type (or method) to its unique byte code representation by eliding type parameters and arguments. OK, let's understand what that means. Below is a simple class which uses the generified version of Java Lists. package net.adaptivelearningonline.examples.generics; import java.util.ArrayList; import java.util.Iterator; import java.util.List; public class GenericsErasure { public static void main ( String args []) { List<String> list = new ArrayList<String> () ; ...
Write Awesome User Manuals and Tutorials for Software Products