从excel文件里读取数据,遇到姓名相同的数据跳过,请问怎么做效率最高?
如:
for(int i=0; i< maxnum; i++) { //.........................
}maxnum是excel文件的记录条数
如:
for(int i=0; i< maxnum; i++) { //.........................
}maxnum是excel文件的记录条数
调试欢乐多
我目前的做法是:
for(int i=0; i< maxnum; i++) {
HSSFRow row = sheet.getRow(i);
HSSFCell userIds = row.getCell((short) 0);
String userId = valueToString(userIds); //姓名(excel表的第1行第1列值)
.......................
List temp = new ArrayList();
if(temp.indexOf(userId) >= 0) {
continue;
} else{
//user.setUserId(userId);
//..........
//Factory.getUserFactory.createuser(user);
temp.add(userId);
}
}