LoginSignup
1
0

More than 5 years have passed since last update.

NSMutableDictionary にハッシュでその名前が呼ばれたかどうかを確認する方法

Posted at
NSMutableDictionary *t = [[NSMutableDictionary alloc] init ];
NSMutableArray *names = [NSMutableArray array];

// t にインデックスを、その名前が呼ばれたかどうかを判別させるためのマップを作る。

while([self.dummyPerson count] != 3){
    int r = arc4random() % [self.followers count];


    NSMutableDictionary *follower = [self.followers objectAtIndex:r];
    NSString *fName = [follower valueForKey:@"screen_name"];


   // もしも、その名前が存在していなかったら、作る。 
    if (![t valueForKey:fName]){
        [self.dummyPerson addObject:[self.followers objectAtIndex:r]];
    }

    [t setValue:@"exist" forKey:[self screenNameAt:r]];
}
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0