[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Need help/examples with enumerated lists (ooops...)
From: |
Benedikt Stefansson |
Subject: |
Re: Need help/examples with enumerated lists (ooops...) |
Date: |
Thu, 16 Jul 1998 13:44:15 -0700 |
Ooops,
I made a stupid mistake:
> int i,member;
>
> for(i=0;i<[contactList getCount];i++) {
> member=[contactList atOffset: i];
> if([memberList contains: member]==1)
> [contactList remove: member];
> }
Sorry, that's going to fail of course, because the remove will affect the list
that is being looped over. Change it to:
for(i=0;i<[memberList getCount];i++) {
member=[memberList atOffset: i];
if([contactList contains: member]==1)
[contactList remove: member];
}
I wrote it the other way first, because the contains: and remove: methods in
collections duplicate the same effort (to find the member pointer). There might
be a faster way to do this, but certainly it would be messier code.
Regards,
-Benedikt
==================================
Swarm-Support is for discussion of the technical details of the day
to day usage of Swarm. For list administration needs (esp.
[un]subscribing), please send a message to <address@hidden>
with "help" in the body of the message.
==================================
- Need help/examples with enumerated lists, Paul E. Johnson, 1998/07/16
- Re: Need help/examples with enumerated lists, Benedikt Stefansson, 1998/07/16
- Re: Need help/examples with enumerated lists (ooops...),
Benedikt Stefansson <=
- Re: Need help/examples with enumerated lists (ooops...), Ken Cline, 1998/07/21
- Re: Need help/examples with enumerated lists (ooops...), Benedikt Stefansson, 1998/07/21
- @deftype and Objective-C Reference, Michael Whidden, 1998/07/22
- Re: @deftype and Objective-C Reference, Sven N. Thommesen, 1998/07/22
- Problems on displaying graphs, Alessandro Perrone, 1998/07/22
- Re: Problems on displaying graphs, Marcus G. Daniels, 1998/07/22
- Re: Problems on displaying graphs, James Marshall, 1998/07/22
- Re: Problems on displaying graphs, Pietro Terna, 1998/07/22
- Re: @deftype and Objective-C Reference, Marcus G. Daniels, 1998/07/22