A problem is that the right hand size of =
has no idea what type you want on the left hand side. i.e. java doesn't do this kind of type inference.
A method doesn't know what type you need a return type to be. (I have seen exceptions at runtime with MethodHandles and I suspect that Java 8 or 9 might introduce these features)
e.g. very basic type inference for return types isn't done at runtime (or compile time)
public Double getValue() {
return 5.0;
}
double d = m.getValue(); // not smart enough to avoid creating a `Double` here.
With Generics you have the added bonus of type erasure. This mean E[]
is actually Deal[]
at runtime. Which Deal type you might have liked is lost.