category: Developers
You may think generics is all about avoiding casts in collections. However, I found a really good use for them the other day that's pretty useful.
Let's say you have a method which takes a List and does something with it.
void doSomething(List list) {
...
}
(In my code, it's actually List, but I'm trying to keep other generics out of this to...
More »