Difference Lists.newArrayList () and new ArrayList () of

List<String> list = new ArrayList<String>(); 

 

List<String> list = new ArrayList<String>(); 

 

Lists and Maps are two tools, Lists.newArrayList () actually and new ArrayList () almost exactly the same, the only help you to do it (in fact, javac help you do), is the automatic derivation (not "inverted") angle brackets in data types. 

 

But now the JDK version, if not write data types in the back of the equal sign in angle brackets can also be automatically recognized. So Lists.newArrayList () and new ArrayList () lacks distinction

Guess you like

Origin www.cnblogs.com/xdsuannai/p/11910878.html