[github-408] Increase performance of StylesTable.putStyle. Thanks to Jason Mirra. This closes #408

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1906152 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2022-12-21 22:30:32 +00:00
parent f78d742c38
commit 7807b706ac
1 changed files with 4 additions and 2 deletions

View File

@ -467,10 +467,12 @@ public class StylesTable extends POIXMLDocumentPart implements Styles {
public int putStyle(XSSFCellStyle style) { public int putStyle(XSSFCellStyle style) {
CTXf mainXF = style.getCoreXf(); CTXf mainXF = style.getCoreXf();
if(! xfs.contains(mainXF)) { int ret = xfs.indexOf(mainXF);
if(ret == -1) {
xfs.add(mainXF); xfs.add(mainXF);
ret = xfs.size() - 1;
} }
return xfs.indexOf(mainXF); return ret;
} }
@Override @Override