[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Deserializaton order
From: |
Frederico Muñoz |
Subject: |
Re: Deserializaton order |
Date: |
Sun, 03 Apr 2005 16:02:43 +0200 |
Hello,
On 2005-04-03 07:15:35 +0100 Richard Frith-Macdonald <address@hidden> wrote:
> On 2005-04-02 22:51:50 +0100 Frederico Muñoz <address@hidden> wrote:
>
>> The problem I'm having is that when I deserialize the data into a
>> NSDictionary to perform the copy operations that filenames appear in random
>> order,
(...)
> The order of keys in a dictionary is undefined (nothing to do with
> serialization ... that's the case wherever you use a dictionary or set) ...
> so you can't depend on key ordering. What you can do is simply serialize an
> additional object ... an array containing all the keys in the correct order
> ... so then to do the copy you simply deserialize both the dictionary and the
> array, then iterate through the array using the values as keys to obtain the
> files you need to copy.
Ah, ok, thanks. I was mixing the efect for the cause, since I saw the
serialized data (in XML) in the right order I assumed that the "problem" was
with the deserialization process. I will do as you told, add an array. I also
read about the sort methods of NSDictionary, but didn't get far because it
works on the keys, and I at most could add a "Order" key with a value in the
NSDictionary that is the value for the key.
Best regards,
fsmunoz
--
Frederico Muñoz