且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Java中将ArrayList转换为另一个ArrayList

更新时间:2023-11-27 22:05:04

我认为您需要将第一个列表从元素0迭代到最后,将每个返回的项目拆分成其组成部分,并将每个部分添加到第二个部分数组.


hi i have an ArrayList like this

[100, 101, 110, 011, 1111, 1110, 010, 00, 00]



i want to convert that ArrayList to something like this

[1,0,0,1,0,1,1,1,0,0,1,1,1,1,1,1,1,1,1,0,0,1,0,0,0,0,0]



please help me
thx

I would think you need to iterate the first list from element 0 to the end, splitting each returned item into its constituent parts and adding each part to the second array.