Questions tagged [nsmutableset]

The NSMutableSet class declares the programmatic interface to a mutable, unordered collection of distinct objects.

The NSMutableSet class declares the programmatic interface to an object that manages a mutable set of objects. NSMutableSet provides support for the mathematical concept of a set.

NSMutableSet is “toll-free bridged” with its Core Foundation counterpart, CFMutableSetRef.

Resources:

74 questions
22
votes
1 answer

how to intersect two arrays in objective C?

I have two arrays . Array1 contains 15 objects and Array2 contains 4 objects. There are 2 common objects from both array, I just want to get that resulted array of that 2 objects. It should be like intersection of two Set, but how to do in…
Dishant
  • 917
  • 2
  • 8
  • 25
18
votes
3 answers

Objective c - NSMutableSet unique object property

In my app I have a class Person with personId property. Now I need some data structure to hold a bunch of unique Person objects (unique = different personId) So I guess I should use NSMutableSet as my data structure, but how do I make the…
Eyal
  • 10,777
  • 18
  • 78
  • 130
7
votes
3 answers

Key-Value Observing an NSMutableSet

In a plain class I have a NSMutableSet property. Whenever objects are added to or removed from the set, I want to perform some custom code. I know I could write a few addObjectToSet:-like methods to the class, but I was wondering if there's a more…
epologee
  • 11,229
  • 11
  • 68
  • 104
6
votes
1 answer

NSMutableSet contains Duplicates

I have a custom class called card and I need to create a set of 10 unique cards from an array of cards of a random size. Also, I need include any whitelisted cards first to make sure they are always included. My problem is cards from the whitelist…
hokiewalrus
  • 551
  • 5
  • 17
5
votes
3 answers

objective-c sort NSMutableSet of NSStrings?

Possible Duplicate: What is the most efficient way to sort an NSSet? I currently have an NSMutableSet with the following a list of strings. e.g.: {@"c",@"d",@"e",@"f",@"g",@"a"} Can someone please tell me how I can sort these values…
dpigera
  • 3,339
  • 5
  • 39
  • 60
5
votes
3 answers

Find objects with the same property value in NSMutableSet

I have NSMutableSet of objects. All objects are unique obviously, but they might have same .angle value, which is NSInteger property. I need to find out if there are two or more objects with the same .angle value and group then into an array. How…
devster
  • 53
  • 1
  • 4
3
votes
2 answers

Why doesn't NSMutableSet remove an object contained in it?

I have an NSMutableSet set that contains custom made objects who are a subclass of SKNode. I am making a game where these objects are added and removed from the NSMutableSet. I am adding and removing from the main thread, so threading isn't an…
3
votes
3 answers

NSMutableSet with custom isEqual: and hash callbacks

I am trying to create a custom NSMutableSet that doesn't use the standard isEqual: and hash selectors on objects. Typically I want to use this with Parse. I have a NSMutableSet containing PFObject subclass instances, and I consider them equal if…
deadbeef
  • 5,409
  • 2
  • 17
  • 47
2
votes
1 answer

Populate NSMutableSet with an Object is not working - NSLog and Debugger shows Null

I am trying to create a set of objects using NSMutableSet. The object is a tag, each tag has an id and a name. The tag class is defined like so: #import "Tag.h" @implementation Tag @synthesize id, name; +(id) populateTagObjectWithId:(NSString…
ElasticThoughts
  • 3,417
  • 8
  • 43
  • 58
2
votes
2 answers

Problem combining NSMutableSets

I have the following code: NSMutableSet* localSet = [[NSMutableSet alloc] initWithArray:symbols]; NSMutableArray* fetchedSymbolsArray = [NSMutableArray array]; for (NSDictionary* symbol in fetchedSymbols) { [fetchedSymbolsArray…
Sheehan Alam
  • 60,111
  • 124
  • 355
  • 556
2
votes
1 answer

Protocol bridging NSMutableSet and NSMutableOrderedSet together

In Swift 3, I would like to be able to create a protocol which allows me to add elements and iterate through using for element in. The protocol should works on both NSMutableSet and NSMutableOrderedSet (since they do not inherit from the same…
Sajjon
  • 8,938
  • 5
  • 60
  • 94
2
votes
2 answers

NSMutableSet not adding more than 1 object

I am creating a label (CorePlot) object in a for loop and trying to add it to NSMutableSet which I need to pass a a parameter. Strangely only one object if added to the NSMutableSet (first one) and others are not added. Looks like I am missing…
Dev
  • 6,207
  • 4
  • 27
  • 32
2
votes
1 answer

NSMutableSet Set Minus Set Not Working

I must be missing something fundamental - hopefully someone can point it out to me. I have two NSSets. Set A contains 40 NSNumber values and set B contains 20 NSNumber values. Set A contains all of set B's 20 values plus 20 other values not shared…
jac300
  • 5,182
  • 14
  • 54
  • 89
2
votes
2 answers

How to use NSPredicate to filter NSMutableSet which contains composite object from other Class?

Newbie Questions, I have 3 Class, 3 of them are subclass from NSOBject. Collection Class, have 2 properties, masterSong as NSMutableSet (strong, nonatomic) and listOfPlaylists as NSMutableArray (strong, nonatomic) Playlist Class Have 2…
2
votes
1 answer

Passing NSSet and initialize it with values

in main function I have a set NSMutableSet *set1 = [[NSMutableSet alloc ]init]; NSMutableSet *set2 = [[NSMutableSet alloc ]init]; and I want to have a functions that can "initialize" with some values. Like(but not work) : void initSet…
PlusA
  • 545
  • 1
  • 6
  • 15
1
2 3 4 5