E.G. to create an ArrayList of Strings we have to do something like
List<String> list = new ArrayList<String>();
whereas it should be able to infer the parameter type for the constructor so that we only have to type
List<String> list = new ArrayList();
Why can’t the type be infered in the same way that type parameters are infered for generic methods.
This is a Java 7 improvement also known as the diamond operator. The syntax will be:
The official proposal, accepted for inclusion in Project Coin is Improved Type Inference for Generic Instance Creation
According to Rémi Forax, the change is already in the mercurial repository.