You are running this very heavyweight function in a UI event routine. Expect client UI freezes.
Use an asynchronous thread to run this, and post the results back to the UI with invokeLater()
. (Lots of discussions here on these techniques. Use them before you suffer for it.)
Consider using my orderBy() expression function in a binding. From my Integration Toolkit module.