https://bz.apache.org/bugzilla/show_bug.cgi?id=58525

--- Comment #2 from Richard Hart <[email protected]> ---
(In reply to Javen ONeal from comment #1)
> It looks like you're maintaining two data structures that contain
> essentially the same content, a List and a HashMap. In the interest of
> keeping POI's memory footprint down, would it be possible to use just one
> data structure? It might even be faster, since write operations wouldn't
> need to modify 2 data structures.
> 
> > public LinkTable(int numberOfSheets, WorkbookRecordList workbookRecordList) 
> > {
> >   _workbookRecordList = workbookRecordList;
> >   _definedNames = new ArrayList<NameRecord>();
> >   _nameRecordMap = new HashMap<Integer, Map<String, NameRecord>>();
> >   ...
> >   while(true) {
> >     if (nextClass == NameRecord.class) {
> >       NameRecord nr = (NameRecord)rs.getNext();
> >       _definedNames.add(nr);
> >       addToNamesMap(nr);
> >     }
> >   }
> 
> > public void removeBuiltinRecord(byte name, int sheetIndex) {
> >  NameRecord record = getSpecificBuiltinRecord(name, sheetIndex);
> >   if (record != null) {
> >    _definedNames.remove(record);
> >    removeFromNameRecordMap(record);
> >   }
> > }

Indeed. I first tried to replace the names array with a map but as I got
deeper, more and more would have to be changed. The issue is so many methods
use the getName(index) method which is not only fast but cannot be done on a
map. I did not want to break any existing functionality so I added the map.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to