元素类型为String的List怎么转换成String组
sql语句 select name from user 保存在List中
要怎么把他转换成String 组?
先行谢过!
------解决方案--------------------list.toArray( new String[]{} );
------解决方案--------------------list.toArray( new String[0] );
------解决方案--------------------list.toArray(new String[list.size()])
------解决方案--------------------String [] array = (String [])list.toArray(new String[list.size()])
------解决方案--------------------String[] strArray=new String[list.size()];
int i=0;
for(String s:list)
strArray[i++]=s;
------解决方案--------------------String [] array = (String [])list.toArray(new String[list.size()])
------解决方案--------------------String [] array = (String [])list.toArray(new String[list.size()])
同样适合ArrayList到数组之间的转换