]> source.dussan.org Git - poi.git/commitdiff
Fix generics warnings
authorNick Burch <nick@apache.org>
Sat, 29 Sep 2012 21:25:44 +0000 (21:25 +0000)
committerNick Burch <nick@apache.org>
Sat, 29 Sep 2012 21:25:44 +0000 (21:25 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1391885 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/poi/hssf/usermodel/HSSFOptimiser.java

index 66327d9417b74e43285b4f51d0f2e2eb477c4dfa..50489ef24b56f38912512d5f065345d863e9bdf6 100644 (file)
 package org.apache.poi.hssf.usermodel;
 
 import java.util.HashSet;
-import java.util.Iterator;
 
 import org.apache.poi.hssf.record.ExtendedFormatRecord;
 import org.apache.poi.hssf.record.FontRecord;
 import org.apache.poi.hssf.record.common.UnicodeString;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.Row;
 
 /**
  * Excel can get cranky if you give it files containing too
@@ -135,17 +136,13 @@ public class HSSFOptimiser {
                //  the new locations of the fonts
                // Remember that one underlying unicode string
                //  may be shared by multiple RichTextStrings!
-               HashSet doneUnicodeStrings = new HashSet();
+               HashSet<UnicodeString> doneUnicodeStrings = new HashSet<UnicodeString>();
                for(int sheetNum=0; sheetNum<workbook.getNumberOfSheets(); sheetNum++) {
                        HSSFSheet s = workbook.getSheetAt(sheetNum);
-                       Iterator rIt = s.rowIterator();
-                       while(rIt.hasNext()) {
-                               HSSFRow row = (HSSFRow)rIt.next();
-                               Iterator cIt = row.cellIterator();
-                               while(cIt.hasNext()) {
-                                       HSSFCell cell = (HSSFCell)cIt.next();
-                                       if(cell.getCellType() == HSSFCell.CELL_TYPE_STRING) {
-                                               HSSFRichTextString rtr = cell.getRichStringCellValue();
+                       for (Row row : s) {
+                          for (Cell cell : row) {
+                                       if(cell.getCellType() == Cell.CELL_TYPE_STRING) {
+                                               HSSFRichTextString rtr = (HSSFRichTextString)cell.getRichStringCellValue();
                                                UnicodeString u = rtr.getRawUnicodeString();
                                                
                                                // Have we done this string already?
@@ -244,12 +241,9 @@ public class HSSFOptimiser {
                //  their new extended format records
                for(int sheetNum=0; sheetNum<workbook.getNumberOfSheets(); sheetNum++) {
                        HSSFSheet s = workbook.getSheetAt(sheetNum);
-                       Iterator rIt = s.rowIterator();
-                       while(rIt.hasNext()) {
-                               HSSFRow row = (HSSFRow)rIt.next();
-                               Iterator cIt = row.cellIterator();
-                               while(cIt.hasNext()) {
-                                       HSSFCell cell = (HSSFCell)cIt.next();
+                       for (Row row : s) {
+                          for (Cell cellI : row) {
+                                       HSSFCell cell = (HSSFCell)cellI;
                                        short oldXf = cell.getCellValueRecord().getXFIndex();
                                        HSSFCellStyle newStyle = workbook.getCellStyleAt(
                                                        newPos[oldXf]