I would like to know why it would be a problem if Java had generics without erasure. I know that the problem is compatibility with older libraries, but is it worth it to put Object instead of the type where we will not specify it. For example, we can use List list = new ArrayList();
as List<Object>
-s collection, and List<Integer> list = new ArrayList<Integer>();
will be the same as without erasure.
Can someone please show an example of what happens if erasure does not come into play.
source share