难题 可变二维字符数组如何初始化问题List<String> strListChangedLog[];
1。二维字符数组如何初始化List <String> strListChangedLog[];
Eclipse `报错,请问有何高招?另外,
2。下面的语句有一个预编译警告错误,如何去除?(定义一个字符窜树组)
List <String> strListMergedResult = new ArrayList();
附代码
int nTobeMergedList = 0;
int nAllFileNum = strListFromXMLFileNames.size();
List <String> strListChangedLog[];
try{
for(int nFileIndex = 0;nFileIndex < nAllFileNum ;nFileIndex++){
strListChangedLog[nFileIndex] = new ArrayList();
nTobeMergedList = nTobeMergedList + ChangeAccessLog(strListFromXMLFileNames.get(nFileIndex),strTargetdate,nFileIndex,strListChangedLog[nFileIndex]);
}
}catch(Exception e){
e.printStackTrace();
}
------解决方案-------------------- List strListChangedLog[] = new ArrayList[10];
for(int i=0; i <strListChangedLog.length; i++){
strListChangedLog[i] = new ArrayList <String> ();
}
List <String> strListMergedResult = new ArrayList <String/*指定类型*/> ();
------解决方案--------------------顶,今天看项目Source,刚好看到这个地方,正在学习啊
------解决方案--------------------List <String> =new TreeList <String> ();
应该是这样用!
------解决方案--------------------List <String> strListResult = new ArrayList <String> ();
------解决方案--------------------两维数组可以用List进行替代:
List <List <String> > a = new ArrayList <List <String> > ();