Home > Back-end >  Delphi list grouping
Delphi list grouping

Time:09-19

PersonItem:=TPersonItem. Create;
PersonItem. See colour:="yellow";
PersonItem. Old:=10;
List. The Add (PersonItem);

PersonItem:=TPersonItem. Create;
PersonItem. See colour:="black";
PersonItem. Old:=11;
List. The Add (PersonItem);

PersonItem:=TPersonItem. Create;
PersonItem. See colour:="white";
PersonItem. Old:=22;
List. The Add (PersonItem);

PersonItem. See colour:="yellow";
PersonItem. Old:=33;
List. The Add (PersonItem);
. There are many kinds of color, may I now want to according to the statistics of the old and the color, is actually want to achieve the function of the database group by, but is in the LIST

CodePudding user response:

Inefficient, enumerated List, according to the color additive,
Efficient, add good and when I was,

CodePudding user response:

Create a dynamic array, when creating PersonItem, the Old value according to the color classification, accumulation,

CodePudding user response:

The second floor is the general direction, the measures for the implementation of the third floor is

Can establish a linked list, the required data into the linked list, with a dynamic array
  • Related