> On 09 Feb 2015, at 17:27, Yuriy Tymchuk <[email protected]> wrote:
> 
> Then what is good?
> 
> Does it make sense to wrap dictionary and use keys for the part that I use 
> for equality? Because I need to have instances of a class to appear only 
> once, but I want to be able to override instance when I add a new one.

Dictionary does sound better to me. #noCheckAdd: would only work if both 
objects had the same equality definition anyway and other options always 
include two explicit operations (remove + add), while dictionary allows 
explicit writes and has #at:ifAbsent:put which will return the stored object or 
the newly put one if none was there.

Cheers,
Max

> 
> Uko
> 
>> On 09 Feb 2015, at 17:22, Max Leske <[email protected]> wrote:
>> 
>> 
>>> On 09 Feb 2015, at 17:08, Yuriy Tymchuk <[email protected]> wrote:
>>> 
>>> Hi, I’m looking for a way to add an element to a Set and override the 
>>> existing one if it is already in the set. I found #noCheckAdd: method, but 
>>> a comment says that it should be deprecated. Is there any other solution I 
>>> should follow?
>> 
>> Why would you want to do that? If you need to replace the object then they 
>> are obviously not equal and a set may be the wrong data structure...
>> 
>>> 
>>> Uko
>> 
>> 
> 
> 


Reply via email to