Board index » delphi » What have they done with Tcollection ?

What have they done with Tcollection ?

Hello,
  I am rewriting my programs from Turbo-Vision to Delphi. In
Turvo-vision I regulary used the T(sorted)collection object. It had
several nice features like FirstThat, ForEach, LastThat and Compare.
It was a very nice object for managing (sorted) lists. Now i am
rewriting for Delphi I don't seem to find a good equivalent for the
old Tcollection object. You have the Tlist class but it does not have
one of the methods i mentioned above. Does someone have a suggestion ?
or How to build a Tcollection from a Tlist ?

Greetings,
  Jelle.

 

Re:What have they done with Tcollection ?


Jelle

Borland decided in it's wisdom that we no longer have a need for
TCollection. I know that someone wrote a freeware TCollection for Delphi.
I saw it on the Delphi Super Page. I think it was called EZDSL200.ZIP.
Hope you can find it.

Johan Kotze

Quote
> jdijk...@mail.dds.nl (Jelle Dijkstra) wrote in article

<4pj28u$...@alibaba.dds.nl>...
Quote
> Hello,
>   I am rewriting my programs from Turbo-Vision to Delphi. In
> Turvo-vision I regulary used the T(sorted)collection object. Now i am
> rewriting for Delphi I don't seem to find a good equivalent for the
> old Tcollection object.

>   Jelle.

Re:What have they done with Tcollection ?


TCollection from TVision owned its contents,
TList does not. The difference is in the
dtor: if your TCollection.Destroy Free's
each object in the collection, then it must
be the owner.

The Delphi Design Guide by Teixeira & Pacheco
published a _very_ buggy TCollection, so I don't
recommend it.

Instead, design yourself a TBaseIterator, and
derive a type-safe TMyIterator for your special
list.

I also recommend adding the
function TMYList.LastIndex: integer;
begin
  Result := Count-1;
end;

Re:What have they done with Tcollection ?


TCollection from TVision owned its contents,
TList does not. The difference is in the
dtor: if your TCollection.Destroy Free's
each object in the collection, then it must
be the owner.

The Delphi Design Guide by Teixeira & Pacheco
published a _very_ buggy TCollection, so I don't
recommend it.

Instead, design yourself a TBaseIterator, and
derive a type-safe TMyIterator for your special
list.

I also recommend adding the
function TMYList.LastIndex: integer;
begin
  Result := Count-1;
end;

Re:What have they done with Tcollection ?


TCollection from TVision owned its contents,
TList does not. The difference is in the
dtor: if your TCollection.Destroy Free's
each object in the collection, then it must
be the owner.

The Delphi Design Guide by Teixeira & Pacheco
published a _very_ buggy TCollection, so I don't
recommend it.

Instead, design yourself a TBaseIterator, and
derive a type-safe TMyIterator for your special
list.

I also recommend adding the
function TMYList.LastIndex: integer;
begin
  Result := Count-1;
end;

Other Threads