Posts Tagged ‘Dolphin’
Java 7 diamonds
Tiger (Java 5) introduced new syntax, among which generics are the most used. Mustang (Java 6) did not offer anything new. Dolphin (Java 7) will introduce a new scheme, the “diamond syntax”. We deal of diamond because of the look of theses characters: “<>
”
To sum up quickly, in Java 5 we have to write:
[java]
List<Integer> myList = new ArrayList<Integer>()
Map<String, List<Double>> myMap = new Hashmap<String, List<Double>>();[/java]
On last Dolphin development releases, we can simply write:
[java]
Lis<Integer> myList = new ArrayList<>()
Map<String, List<Double>> myMap = new Hashmap<>();[/java]
There’s nothing revolutionary, but developpers will save a little more time ;-).