Re: Problems with NSArray and iterators
Re: Problems with NSArray and iterators
- Subject: Re: Problems with NSArray and iterators
- From: Florijan Stamenkovic <email@hidden>
- Date: Sat, 20 Aug 2005 12:53:08 +0200
Soooo.... assignedClients().iterator() contains some null values, but
assignedClients().vector().iterator() doesn't?
Hi.
Couldn't see anything in the Vector API to suggest that it does not
accept null values, although that would not be uncommon. Regardless of
that, "Iterator" is an interface, and instances returned by various
Collections classes (or NSArray), are different implementations of it
(inner classes to the relevant container I assume) that implement the
Iterator interface.
This does not sound good however, and I can't see the reason why the
Iterator of Vector should be implemented to skip null values, as Vector
itself does not seem to conform to such behavior.
But what about that NSArray you are dealing with? Should it really
contain null values? If yes, then it is OK, although the behavior of
Vector's iterator would be a bit strange. If no, then there is a
serious screw up in the NSArray's implementation of Iterator.
You can make a simple test by listing out first all the values for the
NSArray through objectAtIndex(int index), then listing it through an
Iterator, then getting the Vector() (which you should avoid in new code
actually as it is deprecated), listing it with get(int index), and
finally listing the array out through Vector's iterator. And see where
the null values are, and where not.
I must be missing something!
Thanks in advance,
Jarvis
Cheers
Flor
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden