Unit 'Contnrs' Package
[Overview][Constants][Types][Classes][Procedures and functions][Index] [#fcl]


[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Custom bucket list class.


Source position: contnrs.pp line 537

type TCustomBucketList = class(TObject)


  destructor Destroy; override;


Frees the bucketlist from memory.

  procedure Clear;


Clear the list.

  function Add();


Add an item to the list.

  procedure Assign();


Assign one bucket list to another.

  function Exists();


Check if an item exists in the list.

  function Find();


Find an item in the list.

  function ForEach();


Loop over all items.

  function Remove();


Remove an item from the list.

  property Data []: Pointer; default; [rw]


Associative array for data pointers.





Custom bucket list class.




TCustomBucketList is an associative list using buckets for storage. It scales better than a regular TList list class, especially when an item must be searched in the list.

Since the list associates a data pointer with each item pointer, it follows that each item pointer must be unique, and can be added to the list only once.

The TCustomBucketList class does not determine the number of buckets or the bucket hash mechanism, this must be done by descendent classes such as TBucketList. TCustomBucketList only takes care of storage and retrieval of items in the various buckets.

Because TCustomBucketList is an abstract class - it does not determine the number of buckets - one should never instantiate an instance of TCustomBucketList, but always use a descendent class such as TCustomBucketList.

See also



Default bucket list implementation.

Documentation generated on: Jul 24 2023