Difference between revisions of "LazUtils"

From Free Pascal wiki
m (TDictionaryStringList)
m (TDictionaryStringList)
Line 5: Line 5:
 
This is an unsorted TStringList with a fast lookup feature. Internally it uses a string map container to store the string again. It is then used for InserItem, Contains, IndexOf and Find methods. The extra container does not reserve excessive memory because the strings are reference-counted and not actually copied. TDictionaryStringList fully supports all Duplicates property values including dupIgnore and dupError. An unsorted TStringList lacks this support for some values of Duplicates.
 
This is an unsorted TStringList with a fast lookup feature. Internally it uses a string map container to store the string again. It is then used for InserItem, Contains, IndexOf and Find methods. The extra container does not reserve excessive memory because the strings are reference-counted and not actually copied. TDictionaryStringList fully supports all Duplicates property values including dupIgnore and dupError. An unsorted TStringList lacks this support for some values of Duplicates.
  
This class is particularly useful when you need to preserve the order in which strings have been inserted in a list at the same time as needing the ability to do fast lookups (to check if a string is already listed), when you need to prevent addition of duplicate strings.
+
This class is particularly useful when you need to preserve the order in which strings have been inserted into an unsorted list at the same time as needing the ability to do fast lookups (to check if a string is already listed), when you need to prevent addition of duplicate strings.

Revision as of 15:26, 19 March 2013

TDictionaryStringList

This is an unsorted TStringList with a fast lookup feature. Internally it uses a string map container to store the string again. It is then used for InserItem, Contains, IndexOf and Find methods. The extra container does not reserve excessive memory because the strings are reference-counted and not actually copied. TDictionaryStringList fully supports all Duplicates property values including dupIgnore and dupError. An unsorted TStringList lacks this support for some values of Duplicates.

This class is particularly useful when you need to preserve the order in which strings have been inserted into an unsorted list at the same time as needing the ability to do fast lookups (to check if a string is already listed), when you need to prevent addition of duplicate strings.