I have a collection of about 1000 objects inheriting from TNamed in a clones array and I want to have a fast acces via their names. The common approach to get an object from a list is the use of TObjArray::FindObject(“name”). However, this method uses a sequential scan and is therefore slow.
I’m thinking of using a hash table or a binary tree for a faster access. I know that Root provides already functionality here (THashTable, TMap). Can somebody provide a simple example how to use them in an effective way? In my case the object names have a length of 8-10 characters each. The names are very similar and sometimes they differ in one character only.