In an attempt to see if I can clean up some of my math code, mostly matrix stuff, I am trying to use some Java Generics. I have the following method:
private <
Generics and arrays don't match very well. Creating a generic array is not allowed since it would not be typesafe. It stems from the fact that if Sub is a subtype of Super, then Sub[] is a subtype of Super[], which is not the case of generic types; for any two distinct types Type1 and Type2, List is neither a subtype or a supertype of List. (Effective Java covers this in chapter 5, item 25).