What is the practical difference between
Map<String, String> myMap = new HashMap<String, String>();
and
Map<String, String> myMap = new HashMap<>();
Neither throw any warnings and both seem to work fine ...
The second notation is called diamond operator , and was introducted in Java 7 as part of the project Coin ( JSR 334 ).
There is no pratical difference between the two notations, it just save our tired fingers from few keybord entries :)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.