怎样取出List中对象的值?
List alist = ud.getResourceListByUserId("admin");
for(Iterator ite = alist.iterator() ; ite.hasNext() ; ){
List blist = (List)ite.next();
log.info(ite.next());
for(Iterator it = blist.iterator() ; it.hasNext() ; ){
Object obj = (Object)it.next();
log.info(obj);
}
}但是运行不成功,请问大家怎样取出List中对象的值,就是类似List<List>取值。谢谢。
List alist = ud.getResourceListByUserId("admin");
for(Iterator ite = alist.iterator() ; ite.hasNext() ; ){
List blist = (List)ite.next();
log.info(ite.next());
for(Iterator it = blist.iterator() ; it.hasNext() ; ){
Object obj = (Object)it.next();
log.info(obj);
}
}但是运行不成功,请问大家怎样取出List中对象的值,就是类似List<List>取值。谢谢。
for(Iterator ite = alist.iterator() ; ite.hasNext() ; ){
List blist = (List)ite.next();
log.info(ite.next());
for(Iterator it = blist.iterator() ; it.hasNext() ; ){
Object obj = (Object)it.next();//这里不用Object啊,用具体放进去的类型啊
比如MyBean bean = (MyBean)it.next();
log.info(bean.get....);
}
}
其中第四个元素"null"不是在 1,"我","[email protected]" 的对像Resource.java中的所以就不知道怎样拿这些复合元素。
for(Iterator ite = alist.iterator() ; ite.hasNext() ; ){
List blist = (List)ite.next();
log.info(ite.next());
for(Iterator it = blist.iterator() ; it.hasNext() ; ){
String str = (String)it.next();//不知道你当时是怎么样Add的
log.info(bean.get....);
}
}
xxxBean.setXxx("fdsa");
list.add(xxxBean);List list = xxx.getList();
if(!list.isEmpty){
for(int i = 0 ; i < list.size() ; i++){
XxxBean xxxBean = (XxxBean)list.get(i);
System.out.println(xxxBean.getXxx());
}
}
for(Iterator ite = alist.iterator() ; ite.hasNext() ; ){
List blist = (List)ite.next();
log.info(ite.next());
for(Iterator it = blist.iterator() ; it.hasNext() ; ){
Object obj = (Object)it.next();//这里不用Object啊,用具体放进去的类型啊
比如MyBean bean = (MyBean)it.next();
log.info(bean.get....);
}
}