fix generics compiler warnings

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1151798 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sergey Vladimirov 2011-07-28 11:34:16 +00:00
parent 45b4dc4a88
commit ef3edb8fa9

View File

@ -21,7 +21,6 @@ package org.apache.poi.ddf;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.Iterator;
import java.util.List; import java.util.List;
import org.apache.poi.util.HexDump; import org.apache.poi.util.HexDump;
@ -59,15 +58,13 @@ public class EscherOptRecord
LittleEndian.putShort( data, offset + 2, getRecordId() ); LittleEndian.putShort( data, offset + 2, getRecordId() );
LittleEndian.putInt( data, offset + 4, getPropertiesSize() ); LittleEndian.putInt( data, offset + 4, getPropertiesSize() );
int pos = offset + 8; int pos = offset + 8;
for ( Iterator iterator = properties.iterator(); iterator.hasNext(); ) for ( EscherProperty property : properties )
{ {
EscherProperty escherProperty = (EscherProperty) iterator.next(); pos += property.serializeSimplePart( data, pos );
pos += escherProperty.serializeSimplePart( data, pos );
} }
for ( Iterator iterator = properties.iterator(); iterator.hasNext(); ) for ( EscherProperty property : properties )
{ {
EscherProperty escherProperty = (EscherProperty) iterator.next(); pos += property.serializeComplexPart( data, pos );
pos += escherProperty.serializeComplexPart( data, pos );
} }
listener.afterRecordSerialize( pos, getRecordId(), pos - offset, this ); listener.afterRecordSerialize( pos, getRecordId(), pos - offset, this );
return pos - offset; return pos - offset;
@ -94,11 +91,11 @@ public class EscherOptRecord
private int getPropertiesSize() private int getPropertiesSize()
{ {
int totalSize = 0; int totalSize = 0;
for ( Iterator iterator = properties.iterator(); iterator.hasNext(); ) for ( EscherProperty property : properties )
{ {
EscherProperty escherProperty = (EscherProperty) iterator.next(); totalSize += property.getPropertySize();
totalSize += escherProperty.getPropertySize();
} }
return totalSize; return totalSize;
} }
@ -109,10 +106,10 @@ public class EscherOptRecord
{ {
String nl = System.getProperty( "line.separator" ); String nl = System.getProperty( "line.separator" );
StringBuffer propertiesBuf = new StringBuffer(); StringBuffer propertiesBuf = new StringBuffer();
for ( Iterator iterator = properties.iterator(); iterator.hasNext(); ) for ( EscherProperty property : properties )
propertiesBuf.append( " " {
+ iterator.next().toString() propertiesBuf.append( " " + property.toString() + nl );
+ nl ); }
return "org.apache.poi.ddf.EscherOptRecord:" + nl + return "org.apache.poi.ddf.EscherOptRecord:" + nl +
" isContainer: " + isContainerRecord() + nl + " isContainer: " + isContainerRecord() + nl +
@ -152,13 +149,13 @@ public class EscherOptRecord
*/ */
public void sortProperties() public void sortProperties()
{ {
Collections.sort( properties, new Comparator() Collections.sort( properties, new Comparator<EscherProperty>()
{ {
public int compare( Object o1, Object o2 ) public int compare( EscherProperty p1, EscherProperty p2 )
{ {
EscherProperty p1 = (EscherProperty) o1; short s1 = p1.getPropertyNumber();
EscherProperty p2 = (EscherProperty) o2; short s2 = p2.getPropertyNumber();
return Short.valueOf( p1.getPropertyNumber() ).compareTo( Short.valueOf( p2.getPropertyNumber() ) ); return s1 < s2 ? -1 : s1 == s2 ? 0 : 1;
} }
} ); } );
} }