From the various online articles on Java 7 I have come to know that Java 7 will be having collection literals1 like the following:
List
Not mentioned above is the simplicity of collections of collections. Lets say you want a constant to store the currency names and values of different countries.
// Currency devisions by country, and their various names
Map>> CURRENCIES =
{ "US" : { 1 : ["dollar","buck"],
0.25 : ["quarter"],
0.10 : ["dime"],
0.05 : ["nickel"],
0.01 : ["penny"] },
"UK" : { 1 : ["pound"],
1.05 ["guinea"],
0.125 : ["half crown"],
0.05 : ["shilling","bob"],
0.025 : ["sixpence"] }
};
I have pack an enormous amount of data in twelve extremely legible lines. Had I used ArrayList.of (ten times) and some similar map constructor (four times, with ten Map.EntryPair!), the function calls would have bloated the code and made it significantly harder to read.
While it is definitely in the domain of syntactic sugar, this is the #1 feature I'm looking forward to in Java 7 (if it ever gets out).