用一行代码初始化ArrayList
方法1:
ArrayList<String> arrList1 = (ArrayList<String>) Arrays.asList("Buenos Aires", "Cordoba", "La Plata");
方法2:
List<String> arrList2 = Arrays.asList("Buenos Aires", "Cordoba", "La Plata");
方法3: 个人比较喜欢这种
ArrayList<String> list = new ArrayList<String>() {
{
add("Buy and Hold");
add("Daily");
add("Monthly");
}
};