Don't unnecessarily convert from ArrayList to array, use the ArrayList directly instead, this speeds up BiffViewer and related unit tests
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1554534 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d83461c3fb
commit
dcc34ec845
@ -88,9 +88,8 @@ public final class BiffViewer {
|
||||
temp.add(record);
|
||||
|
||||
if (dumpInterpretedRecords) {
|
||||
String[] headers = recListener.getRecentHeaders();
|
||||
for (int i = 0; i < headers.length; i++) {
|
||||
ps.println(headers[i]);
|
||||
for (String header : recListener.getRecentHeaders()) {
|
||||
ps.println(header);
|
||||
}
|
||||
ps.print(record.toString());
|
||||
}
|
||||
@ -436,7 +435,7 @@ public final class BiffViewer {
|
||||
|
||||
private static final class BiffRecordListener implements IBiffRecordListener {
|
||||
private final Writer _hexDumpWriter;
|
||||
private final List<String> _headers;
|
||||
private List<String> _headers;
|
||||
private final boolean _zeroAlignEachRecord;
|
||||
private final boolean _noHeader;
|
||||
public BiffRecordListener(Writer hexDumpWriter, boolean zeroAlignEachRecord, boolean noHeader) {
|
||||
@ -462,10 +461,9 @@ public final class BiffViewer {
|
||||
}
|
||||
}
|
||||
}
|
||||
public String[] getRecentHeaders() {
|
||||
String[] result = new String[_headers.size()];
|
||||
_headers.toArray(result);
|
||||
_headers.clear();
|
||||
public List<String> getRecentHeaders() {
|
||||
List<String> result = _headers;
|
||||
_headers = new ArrayList<String>();
|
||||
return result;
|
||||
}
|
||||
private static String formatRecordDetails(int globalOffset, int sid, int size, int recordCounter) {
|
||||
|
Loading…
Reference in New Issue
Block a user