JAVA List<Object[]>取值问题
三种遍历方法:
一:采用
for(int i = 0 ; i <objListstaff.size(); i++ ){
Object[] tempObj = objListstaff.get(i);
system.out.print("技术部" + tempObj[0] + "————" + "销售部" + tempObj[1] );
}
二:采用迭代器
for (Iterator iterator = objListstaff.iterator(); iterator.hasNext();) {
Object[] tempObj = ( Object[]) iterator.next();
system.out.print("技术部" + tempObj[0] + "————" + "销售部" + tempObj[1] );
}
三:采用foreach循环
for(Object[] tempObj : objListstaff){
system.out.print("技术部" + tempObj[0] + "————" + "销售部" + tempObj[1] );
}
原文链接:https://blog.youkuaiyun.com/lianayu/article/details/8814739