In order to make it faster, I refactored the class to use a map for looking up entries. This wasn't too complex. Unfortunately, once I got all that code updated, it still didn't work, producing a null pointer exception in some other class.
So I fixed that class so that we weren't generating the null pointer exception.
This led into yet another class that was behaving badly. My only excuse for this was that it had been a templated class in C++ that I had to write without generics in Java, because it uses native data storage. So I fixed it.
There is still something wrong in there somewhere.
I will find it in the morning.