You may not modify a group of objects while sequencing over its contents.id item; id aSeq; aSeq = [aCol eachElement]; while ((item = [aSeq next])) [aCol add:something]; /* WRONG !!! */ aSeq = [aSeq free];
- copyReturns a copy of the sequence. Can be used independently of the original sequence.
free
- free
Frees the receiver, but not the objects in the collection being sequenced over.
size
- (unsigned) size
Returns the total number of items in the sequence.
next
- next
Returns the next object in the sequence if there is one and advances the sequence. When it reaches the end of the sequence, returns nil.
peek
- peek
Returns the next object in the sequence if there is one, but does not advance the sequence. When it reaches the end of the sequence, returns nil.
previous
- previous
Returns the object that was returned by the last next message. If there were no next messages since the sequence was created, or the sequence is empty, returns nil. Doesn't affect the current position in the sequence.
first
- first
Returns the first object in the sequence, unlesss there are no members in the sequence, in which case it returns nil. Doesn't affect the current position in the sequence.
last
- last
Returns the last object in the sequence, unlesss there are no members in the sequence, in which case it returns nil. Doesn't affect the current position in the sequence.