2019-06-14 lists.newarraylist()和new arraylist() 区别

lists.newarraylist():

List list = new ArrayList();

new arraylist() :

List list = Lists.newArrayList();

Lists和Maps是两个工具类, Lists.newArrayList()其实和new ArrayList()几乎一模一样, 唯一它帮你做的(其实是javac帮你做的), 就是自动推导(不是"倒")尖括号里的数据类型.

---------------------

List overlyings = Lists.newArrayList(CorePromoType.Unit.getCode(),CorePromoType.Largess.getCode());


作者:未名who

来源:CSDN

原文:https://blog.csdn.net/qq_2300688967/article/details/79490345

版权声明:本文为博主原创文章,转载请附上博文链接!

你可能感兴趣的:(2019-06-14 lists.newarraylist()和new arraylist() 区别)