fix O(n^2) runtime unnecessarily recreating an array inside a for-loop
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1727800 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6c89d062bf
commit
dc860a6f93
@ -301,7 +301,7 @@ public final class EscherAggregate extends AbstractEscherHolderRecord {
|
||||
/**
|
||||
* list of "tail" records that need to be serialized after all drawing group records
|
||||
*/
|
||||
private Map<Integer, NoteRecord> tailRec = new LinkedHashMap<Integer, NoteRecord>();
|
||||
private final Map<Integer, NoteRecord> tailRec = new LinkedHashMap<Integer, NoteRecord>();
|
||||
|
||||
/**
|
||||
* create new EscherAggregate
|
||||
@ -522,8 +522,8 @@ public final class EscherAggregate extends AbstractEscherHolderRecord {
|
||||
pos += writeDataIntoDrawingRecord(drawingData, writtenEscherBytes, pos, data, i);
|
||||
}
|
||||
|
||||
for (i = 0; i < tailRec.size(); i++) {
|
||||
Record rec = (Record) tailRec.values().toArray()[i];
|
||||
for (NoteRecord noteRecord : tailRec.values()) {
|
||||
Record rec = (Record) noteRecord;
|
||||
pos += rec.serialize(pos, data);
|
||||
}
|
||||
int bytesWritten = pos - offset;
|
||||
|
Loading…
Reference in New Issue
Block a user