Currently there's no way to define custom collection operators. However, due to some internal magic there is a funny solution:
NSSet *testSet = [NSSet setWithArray:@[@"one", @(1)]];
id object = [testSet valueForKey:@"@anyObject"];
NSLog(@"anyObject (%@): %@", NSStringFromClass([object class]), object);
UPD: Forgot to mention another handy trick: you can use @lastObject
on NSArray
!