我怎么听得有有点糊涂啊你一步一步说清楚啊List存在Collection里面 这个Collection 具体类 是什么什么类型对象存在List呢

解决方案 »

  1.   

    Object o = list.get(i);
      

  2.   

    是从一个list取出你要的几个属性集合吧?
      

  3.   

    to:interpb
    是这样的:
        public Collection SqlList(String a) throws FindException {
                
                .............            ArrayList list = new ArrayList();            while(rs.next()){
        sqlBean.setTypeName(rs.getString(1));
        .........
        list.add(sqlBean);
                }
               return list;
         }我定义了一个Collection col,获取SqlList的返回值,我现在想从col中取出某一条数据中的几个变量,不知道该怎么取?
      

  4.   

    for (int i = 0; i < list.size(); i++){
       sqlBean = (sqlBeanlist.get(i);
       for (int j = 0 ;j < o.length; j++){
         System.out.println(o[j]);
       }
    }
    取出来的对象转型成sqlBean 就可以 放什么就取什么啊
      

  5.   

    java.util.Iterator it = list.iterator();
    while(it.hasNext()){
    sqlBean sb = (sqlBean)it.next();
    System.out.println(sb.getTypeName());
    }
      

  6.   

    to:chengchaog,谢谢! 用你的方法我取出来了!如果我现在想在每一条记录里再加上一个名字为UserName的变量,并且有值,该怎么做呢?
      

  7.   

    集合套集合,大忌啊
    不如用Object[][] a=new Object[len1][len2];
    //len1为你的collection长度,len2为你的ArrayList的最大长度
      

  8.   

    如果我的list里面存有两个sqlBean呢?能取出来吗?