JAVA List<Object[]>取值问题



//
test 2020-12-2 10:24:34 by kaspar String hql444 = "select sum(collectionPrice),sum(factPrice) from ProcessingCollectionList where processingOrderNumber='"+bean.getProcessingOrderNumber()+"' and collectionPrice != null "; List list444 = baseDao.findByHQL(hql444.toString()); System.out.println(list444.get(0)); List list = new ArrayList(); if(list444!= null && list444.size()>0 ) { Object[] tempObj = (Object[]) list444.get(0); System.out.println("数值一" + tempObj[0] + "————" + "数值二" + tempObj[1] ); } //test

三种遍历方法:
一:采用
for(int i = 0 ; 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] );