Showing posts with label java. Show all posts
Showing posts with label java. Show all posts

2012/03/06

#21. Java generics, type erasure and lazyness

I've been doing a little personal app in Java, and recently found out that generics in Java erase type information so generics would have retro-compatibility (or at least it's what I learnt from reading this post). I can’t deny that I don’t understand the idea and the drawbacks aren’t much but what’s the meaning of doing something halfway. I was just trying to get the type of a generic variable. I don’t think that this was the only option but probably was the easiest.

2011/11/04

#9. W0t...Awww...

Why I need to cast this?¿ Awww...those are the frustrations of programming that sometimes I can’t understand.
image
If getItemList returns a List<I> why .get returns an object?