I have a method in a C# project that looks like this
public T AddEC<T>() where T : EntityComponent, new() {
if (!HasEC<T>())
{
T nComponent = new T();
}
}
Now I have only recently started properly working with Java Generics, but I have no idea how i’d port a method like this, or if its even possible due to the language constraints, can anyone help?
This is a very good article.
http://www.jprl.com/Blog/archive/development/2007/Aug-31.html
From that source