On 01.10.2014 15:21, Rael Bauer wrote:
My main purpose is for lookup hence I chose a hash list, however on some occasions i need to iterate the entire list.
If fast lookup is your main requirement use a hash list.
I notice you use VectorCount: for i := 0 to UnicodeStringHash.VectorCount - 1 do 1) Why not use UnicodeStringHash.Count?
TDIHash vectors store their Items in a separate hash vector. The TDIHash.VectorCount returns the number of slots in that vector. However, not all slots are always filled in, hence the check for TDIHash.IsDeleted().
2) If I do use UnicodeStringHash.Count, then do I still need to check for deleted items?
If you use TDIHash.Count you will miss some items. Do not use it. This rule should explain why:
TDIHash.Count <= TDIHash.VectorCount Ralf _______________________________________________ Delphi Inspiration mailing list yunqa@xxxxxxxxxxxxx //www.freelists.org/list/yunqa