java - 怎么把四个list集合整合到一个集合中。
高洛峰
高洛峰 2017-04-18 09:56:54
0
6
1112

把四个集合里面的内容都存入一个集合(最后的集合已经有了四个集合的set,get方法了)

怎么四变一

高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

reply all(6)
左手右手慢动作

addAll() doesn’t work...

小葫芦

Are the generics of these four collections the same?

刘奇

If the generics are consistent, use the addall() method to add it to a new List. If you need to remove duplicates, use Set’s addall ()

Peter_Zhu

Write a wrapper collection class and delegate to the corresponding sub-collection as needed.
Usually just inherit AbstractList, and the constructor puts four or more sub-collections in.

迷茫

It is recommended that you go to Google's guava toolkit... There are ready-made ones...

阿神

addAll() is enough

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template