Is [[NSNull null] isEqual:[NSNull null]] == YES?
What is the proper way to test if an id is NSNull. As well, if checking two collections for equality and they both contain NSNulls, will they still be considered equal?
Is [[NSNull null] isEqual:[NSNull null]] == YES?
What is the proper way to test if an id is NSNull. As well, if checking two collections for equality and they both contain NSNulls, will they still be considered equal?
Assuming you meant:
No,
NSNull
is a class, not an object. You can't meaningfully compare it to[NSNull null]
. You will always get the same object back from[NSNull null]
, though - it's a singleton. From the documentation:So that means this expression:
Always returns
1
. Likewise:Will return
YES
.Example:
Building & running: