The second way of writing is the new feature of jdk7, generic inference. Based on the generic type when the previous variable is declared, the generic type instantiated later is inferred
The second one is the syntactic sugar provided by JDK7, called Diamond Operator. See this article: http://www.javaworld.com/article/2074080/core-java/jdk-7--the-diamond-operator.html
The second way of writing is the new feature of jdk7, generic inference. Based on the generic type when the previous variable is declared, the generic type instantiated later is inferred
jdk 5 and below versions support List<String> stringList = new ArrayList<String>();
jdk 5+ and above versions all support
The second writing method requires JKD7+. There is no difference between the two writing methods. The second writing method is just a little simpler.
The second one is the syntactic sugar provided by JDK7, called Diamond Operator. See this article: http://www.javaworld.com/article/2074080/core-java/jdk-7--the-diamond-operator.html