为什么ids赋初始值用的是Collections.Emptylist() 而unitKeywords用的是new ArrayList()?

来源:5-17 推广单元限制服务功能实现(2)

幕布斯1199021

2023-02-14

老师您好,想问一下,为什么ids赋初始值用的是Collections.Emptylist() 而unitKeywords用的是new ArrayList()?
(是因为unitKeywords还需要有add()操作所以不能设置为Collections.Emptylist(),要是不需要add()操作就把它设置成Collections.Emptylist()吗? )图片描述

写回答

1回答

张勤一

2023-02-16

没有区别,正常使用就行

1
0

Spring Cloud微服务架构 设计实现广告系统

广告营销系统,未来大中型企业的标配

2143 学习 · 928 问题

查看课程