However, I have a solution that might be good for you. It is attached.
It shows how to use some calls of NSDictionary. If you need others, they
should be quite easy to add.
Thanks for you kind example code. But your sample is not enough for me.
Because your sample can not cheange the value of existing entry. I will
give up using NSMutableArray. I will use a following handmade code
instead of NSMutabelDictionary.
property keyList : {}
property valueList : {}
on getValue given forKey:theKey
set theValue to missing value
repeat with ith from 1 to length of keyList
if item ith of keyList is theKey then
set theValue to item ith of valueList
exit repeat
end if
end repeat
return theValue
end getValue
on setValue given forKey:theKey, withValue:theValue
if theKey is in keyList then
repeat with ith from 1 to length of keyList
if item ith of keyList is theKey then
set item ith of valueList to theValue
exit repeat
end if
end repeat
else
set end of keyList to theKey
set end of valueList to theValue
end if
end setValue
on removeItem given forKey:theKey
if theKey is in keyList then
set nList to length of keyList
repeat with ith from 1 to nList
if theKey is item ith of keyList then
set keyList to deleteNthItem given atIndex:ith, listLength:nList,
fromList:keyList
set valueList to deleteNthItem given atIndex:ith, listLength:nList,
fromList:valueList
exit repeat
end if
end repeat
return true
else
return false
end if
end removeItem