Java Generics are Not that Generic
For example something like this:
template<T> void doSomething(T t)
{
t.doTheWork();
}
Is invalid, because Sun's implementation only allows you to call the methods that are on the Object class. So, instead you have to do something like this:
interface DoWork
{
void doTheWork();
}
template<T extends DoWork> void doSomething(T t)
{
t.doTheWork();
}
Thanks to Bruce Eckle for pointing this out.
Updated: Dare has a good list of reasons for this (turns out the C# team made the same decision)