lists.newarraylist():
List<String> list = new ArrayList<String>();
new arraylist() :
List<String> list = Lists.newArrayList();
Lists和Maps是兩個(gè)工具類, Lists.newArrayList()其實(shí)和new ArrayList()幾乎一模一樣, 唯一它幫你做的(其實(shí)是javac幫你做的), 就是自動(dòng)推導(dǎo)(不是"倒")尖括號里的數(shù)據(jù)類型.
---------------------
List overlyings = Lists.newArrayList(CorePromoType.Unit.getCode(),CorePromoType.Largess.getCode());
作者:未名who
來源:CSDN
原文:https://blog.csdn.net/qq_2300688967/article/details/79490345
版權(quán)聲明:本文為博主原創(chuàng)文章欧引,轉(zhuǎn)載請附上博文鏈接朴乖!