List怎样转化为数组
来源: 互联网 发布时间:2015-02-27
本文导语: List ls = new ArrayList(); List ls1 = new ArrayList(); ls1.add("a"); ls1.add("b"); ls.add(ls1); ls1 = new ArrayList(); ls1.add("c"); ls1.add("d"); ls.add(ls1); 问:ls怎样转化为二维数组。Object[][] | toArray public Object[] toArray() Retur...
List ls = new ArrayList();
List ls1 = new ArrayList();
ls1.add("a");
ls1.add("b");
ls.add(ls1);
ls1 = new ArrayList();
ls1.add("c");
ls1.add("d");
ls.add(ls1);
问:ls怎样转化为二维数组。Object[][]
List ls1 = new ArrayList();
ls1.add("a");
ls1.add("b");
ls.add(ls1);
ls1 = new ArrayList();
ls1.add("c");
ls1.add("d");
ls.add(ls1);
问:ls怎样转化为二维数组。Object[][]
|
toArray
public Object[] toArray()
Returns an array containing all of the elements in this list in proper sequence. Obeys the general contract of the Collection.toArray method.
Specified by:
toArray in interface Collection
Returns:
an array containing all of the elements in this list in proper sequence.
See Also:
Arrays.asList(Object[])
public Object[] toArray()
Returns an array containing all of the elements in this list in proper sequence. Obeys the general contract of the Collection.toArray method.
Specified by:
toArray in interface Collection
Returns:
an array containing all of the elements in this list in proper sequence.
See Also:
Arrays.asList(Object[])