I am facing a situation where I need to sort an excel file.  After much
searching I determined that the functionality is not there.

So I opened the source and began to poke around.  After reading the
source I have come to the conclusion that it has been deliberately
written to make sorting impossible.  

In the HSSFSheet, rows are stored as a TreeMap - an inherently sortable
map but the rows use themselves as keys.  The HSSFRow implements
comparable but uses its own row numbers as the comparison value.

I could easily extend these classes for sorting IF

The rows TreeMap was accessible outside the class.  It is not.
I could extend HSSFRow and override the compareTo method but HSSFRow is
'final'.

So, why is it implemented this way?  Are there some advantages to this
implementation that make it worth blocking out the inherent sort
features of a TreeMap?

Robert Schmid
Senior Research Scientist
Southwest Research Institute
(210) 522-2909



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

Reply via email to