Java 如何将一个列表的内容附加到另一个列表的末尾?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/374586/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 14:00:04  来源:igfitidea点击:

How to append the contents of a list at the end of the other list?

javalistcollections

提问by user47055

How do I append the contents of one list at the end of another list?

如何将一个列表的内容附加到另一个列表的末尾?

回答by Timothy

listA.addAll(listB)

listA.addAll(listB)

回答by Sandy Shrestha

List finalist = a + b

Example:

例子:

List a = [1,4]
List b = [2,3]
List c = a+b

Result:

结果:

c = [1, 4, 2, 3]