Re: anyObject
Re: anyObject
- Subject: Re: anyObject
- From: Kurt Revis <email@hidden>
- Date: Thu, 31 Jan 2002 08:58:02 -0800
I am trying to use the NSSet method anyObject which, according to the
docs, returns a random object selected from the set or, if the set is
empty, nil.
As you found out, in practice it always returns the first object from
the set. The documentation is misleading. When it says "essentially
random" it really means that any object in the set could be returned,
and that you shouldn't care which one it is. The implementation could
change in the future to return the last object added to the set, or a
truly random object in the set, or lots of other things, and it would
still be correct.
(For all I know, there might *currently* be other concrete subclasses of
NSSet which have behavior different than what you encountered.)
Anyway, I recommend filing a bug against the documentation, because it
could be much clearer.
--
Kurt Revis
email@hidden