[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Exception when using GSDictionary in corebase

From: Dr. H. Nikolaus Schaller
Subject: Re: Exception when using GSDictionary in corebase
Date: Fri, 20 May 2011 19:44:06 +0200

Am 20.05.2011 um 19:13 schrieb David Chisnall:

> On 20 May 2011, at 17:20, Dr. H. Nikolaus Schaller wrote:
>> Why aren't you using a NSArray/CFArray to simulate a NSSet? They are much 
>> more similar than
>> dictionaries and sets.
> Not really.  A dictionary is just a set of pairs, where equality is defined 
> by comparing just the first elements of the pairs.  An array is an ordered 
> collection where an elements can occur multiple times.  A set is an unordered 
> collection where elements may occur at most once.  They have very little in 
> common.

It is easy to use an array like a set by:

a) ignoring that an array has an index 
b) and just checking if a new value is already stored to avoid duplicates.

Both have a count, can be enumerated, copied, extended by new objects, checked 
if some object is contained.

I.e. exactly 2 differences and at least 5 commonalities... Makes at least  71% 
similarity :)

One can live wihout NSSet, but you can't without NSArray and NSDictionary...

reply via email to

[Prev in Thread] Current Thread [Next in Thread]