I like the “var” from C # and the “def” from Groovy, and I find that writing types in Java are a pain.
Say I'm writing code like:
List<LongTypeName> results = new ArrayList<LongTypeName>();
or
Map<TypeNameOne,TypeNameTwo> someLookup = fetchMeMyLookup();
What is the easiest way to do this in Java + Eclipse?
I am particularly interested in the case when I am not 100% sure what type will be when the line starts.
My current strategy is to always declare the variables as "int" and then go back to the beginning of the line and make "ctrl-1" and accept the type that was derived by Eclipse. Is there a better alternative?
What I would like is to be able to type "def" or "var", and Eclipse will automatically correct this to the correct type as soon as it can understand.
(Maybe I just need to program in Groovy)