Converting an ArrayList into a 2D Array

前端 未结 8 2228
北海茫月
北海茫月 2020-12-04 01:55

In Java how do you convert a ArrayList into a two dimensional array Object[][]?

From comments: I will describe you the problem with more details: an XML file inclu

8条回答
  •  时光说笑
    2020-12-04 02:44

    I managed to find "a way" to do so, knowing the number of attributes each contacts has (6). So considering an ArrayList listofContacts

        int numberOfContacts = listofContacts.size()/6;
        Object[][] newArrayContent = new Object[numberOfContacts][6];
    
        for(int x = 0; x

提交回复
热议问题