You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ni...@apache.org on 2012/09/29 23:25:45 UTC
svn commit: r1391885 -
/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFOptimiser.java
Author: nick
Date: Sat Sep 29 21:25:44 2012
New Revision: 1391885
URL: http://svn.apache.org/viewvc?rev=1391885&view=rev
Log:
Fix generics warnings
Modified:
poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFOptimiser.java
Modified: poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFOptimiser.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFOptimiser.java?rev=1391885&r1=1391884&r2=1391885&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFOptimiser.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFOptimiser.java Sat Sep 29 21:25:44 2012
@@ -17,11 +17,12 @@
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org