Created
August 20, 2015 12:55
-
-
Save jungchris/fd547c6085d216d30210 to your computer and use it in GitHub Desktop.
indexOfIdInOrganzationsArray
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// used to determine correct location of object in array | |
- (NSInteger)indexOfIdInSessionsArray:(NSNumber*)inputNum { | |
// simple loop. Could use containsObject instead | |
for (NSInteger i = 0; i < [self.sessionsArray count]; i++) { | |
// check for NSNumber object equality | |
SessionsModel *session = self.sessionsArray[i]; | |
if ([session.sessionId isEqual:inputNum]) { | |
return i; | |
} | |
} | |
return NSNotFound; | |
} | |
// used to determine correct location of object in array | |
- (NSInteger)indexOfIdInOrganzationsArray:(NSNumber*)inputNum { | |
// simple loop. Could use containsObject instead | |
for (NSInteger i = 0; i < [self.organizationsArray count]; i++) { | |
// check for NSNumber equality | |
OrganizationsModel *org = self.organizationsArray[i]; | |
if ([org.organizationId isEqual:inputNum]) { | |
return i; | |
} | |
} | |
return NSNotFound; | |
} | |
// used to determine correct location of object in array | |
- (NSInteger)indexOfIdInPresentersArray:(NSNumber*)inputNum { | |
for (NSInteger i = 0; i < [self.presentersArray count]; i++) { | |
PresentersModel *pres = self.presentersArray[i]; | |
if ([pres.presenterId isEqual:inputNum]) { | |
return i; | |
} | |
} | |
return NSNotFound; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Code for use to convert from Objective-C to Java so won't use containsObject.