1 Reply Latest reply: Apr 5, 2007 5:03 AM by 807606 RSS

    comparing string with an element of object[]

    807606
      Ive got A collection (elementColl) that consists of jasperreportmobel objects.
      i terated each object and got the first element of valuelist in s. but these value are appended using blank spaces

      ie i get tempObj[0]=" D";
      this should be equal to "D" which i get in s1.
      s1="D";
      how do i compare tempObj[0] and s1?
      for (Iterator iter = elementColl.iterator(); iter
                                         .hasNext();) {
                                    Object object = (Object) iter.next();
                                    JasperReportModel campusModel = (JasperReportModel) object;
                                    if (i == elementColl.size()) {
                                    
                                         Object tempObj[] = campusModel.getValueList();
                               
                                         if (s1.equals(tempObj[0])) {
                                              iter.remove();
                                         }
      
                                    } else {
                                         i = i + 1;
                                    }
                               }