Re: NSEnumerator and the missing peek method
Re: NSEnumerator and the missing peek method
- Subject: Re: NSEnumerator and the missing peek method
- From: Yann Bizeul <email@hidden>
- Date: Thu, 29 Sep 2005 22:57:54 +0200
If all you want is get each elements of your set in turn, you should
do like everbody does :
while (myObject = [myEnumerator nextObject])
{
doSomething;
}
file:///Developer/ADC Reference Library/documentation/Cocoa/
Reference/Foundation/ObjC_classic/Classes/NSEnumerator.html#//
apple_ref/doc/uid/20000142-BCICDDHA says :
"When nextObject returns nil, all objects have been enumerated."
Yann Bizeul • yann at tynsoe.org
Cocoa Developer
Tynsoe Projects
BuddyPop • GeekTool • SSH Tunnel Manager • ...
http://projects.tynsoe.org/
Le 29 sept. 05 à 22:53, Jan Vereecken a écrit :
Hello,
I'm currently busy with a project where I regularly make use of a
NSEnumerator object to iterate over a set of objects. The "problem"
I'm experiencing is that there is no method to peek at the next
object (for example [enumerator hasNext]). I circumvent the need to
peek via the enumerator with counting the objects of the enumerator
([[enumerator allObjects] count]) and check when the last element
is reached (and do something).
The questions :
- Why didn't the AppKit developers include this (the hasNext
method) in the first place?
- How do other developers conquer this problem?
With kind regards,
Jan Vereecken
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden