Brief introduction of Container class in Delphi2009

Source: Internet
Author: User

Introduction to Container class in Delphi2009:

1.TList class:

A container class that can store pointers provides a set of methods and properties to add, delete, rearrange, locate, access, and sort the classes in the container, which is a container based on an array mechanism that compares similar to vectors in C + + and Java in arraylist,tlist Often used to save a list of objects, an array-based mechanism makes it very fast to use subscripts to access objects in the container, but as the objects in the container increase, the speed of insertions and deletions is plummeting, so it is not appropriate to add and remove objects frequently.

Property Describe
Count:integer; Returns the number of items in a list
Items[index:integer]: pointer; Default Direct access to items in a list by subscript 0 Index
Method Type Describe
ADD (item:pointer): Integer; Function Use to add pointers to the list
Clear; Process Empty items in a list
Delete (Index:integer); Process Delete items in a list that correspond to an index
IndexOf (item:pointer): Integer; Function Returns the index of the pointer in the list
Insert (Index:integer; Item:pointer); Process Inserts an item into the list at the specified location
Remove (item:pointer): Integer; Function Remove a pointer from the list
Name Type Describe
Capacity:integer; Property Can be used to get or set the number of pointers that a list can hold
Extract (Item:pointer): pointer; function Extract is similar to remove to delete a pointer from a list, but to return a pointer that is deleted.
Exchange (Index1, Index2:integer); Procedure Two pointers in the swap list
First:pointer; function Returns the first pointer in a linked list
Last:pointer; function Returns the last pointer in a linked list
Move (Curindex Newindex:integer); Procedure Move the pointer from the current position to the new location
Pack; Procedure Remove all nil pointers from the list
Sort (Compare:tlistsortcompare); Procedure Used to sort items in a linked list, you can set compare parameters for user-defined sort functions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.