AJ.
AJ.

Reputation: 11240

Delphi multiple indexed generic list

I am looking for a TList descendent which lets me add one or more indexes and lets me search and view by these indexes.

A 30min google search session has left me with nothing.

This must have been needed before. I mean how many times have you had a in memory indexed collection and then needed to display it in a different order?

Thanks,

AJ

Upvotes: 4

Views: 1473

Answers (4)

menjaraz
menjaraz

Reputation: 7575

If you are looking for a generic implementation of a Multimap in Delphi, LU RD has pointed to you the right direction in his comment above on delphi-coll.

The namespace Collections.MultiMaps provides a bunch of classes:

  • TDistinctMultiMap: The generic multi-map collection.
  • TDoubleSortedDistinctMultiMap: The generic multi-map collection.
  • TDoubleSortedMultiMap: The generic multi-map collection.
  • TMultiMap: The generic multi-map collection.
  • TObjectDistinctMultiMap: The generic multi-map collection designed to store objects.
  • TObjectDoubleSortedDistinctMultiMap: The generic multi-map collection designed to store objects.
  • TObjectDoubleSortedMultiMap: The generic multi-map collection designed to store objects.
  • TObjectMultiMap: The generic multi-map collection designed to store objects.
  • TObjectSortedDistinctMultiMap: The generic distinct multi-map collection designed to store objects.
  • TObjectSortedMultiMap: The generic multi-map collection designed to store objects.
  • TSortedDistinctMultiMap: The generic distinct multi-map collection.
  • TSortedMultiMap: The generic multi-map collection.

Upvotes: 7

Marcus Adams
Marcus Adams

Reputation: 53830

You can use a sorted TStringList for your index. While it might be nice if your index were encapsulated into your main list object, that's no reason to let it stop you.

Create a new TStringList and have the Object pointer point to whatever you need.

Upvotes: 0

mjn
mjn

Reputation: 36644

Have you considered TClientDataSet? It can be sorted and filtered at runtime. An article can be found at http://edn.embarcadero.com/article/29056

Upvotes: 7

onedevteam.com
onedevteam.com

Reputation: 4178

I'm not sure if delphi supports multiple indexed lists... Maybe you can try with TMS TColumnListBox?

Upvotes: -1

Related Questions