I'm a novice with dictionaries and collections. I have a problem that I'm sure they can solve, but the cryptic RB documentation, or my inability to read it, has left me confused.

I have a set of structures that may have one or several blobs associated with each. Each structure has a name and each blob has a unique number. I start with a list of name-blob number pairs. Names may or may not be unique. I want to end with a list where each name is present once and is associated with all of its blob numbers.

My idea was to associate each name with an integer array.

Because the number of structures is undetermined, I think I have to wrap the integer array into a class, so they can be created as needed.

I want to process a series of name-number pairs. If the name is unique, I want to add the pair as a new entry, with the number being entered into an integer array with one entry. If the name is already there, I want to append the number to the array associated with the name. After the dictionary/collection is constructed, I want to use the name to retrieve the associated blob number or set of blob numbers.

I think I could do this with a collection, where the key-value syntax is fairly clear. But the RB documentation emphasizes the speed advantage of dictionaries. Could anyone please:

1. comment about whether my problem is appropriately addressed with a dictionary or a collection.

2. give the rough syntax of the solution.

Thanks in advance,

John Kubie
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to