summaryrefslogtreecommitdiff
path: root/SmartDeviceLink/NSMutableDictionary+SafeRemove.h
blob: c72371395f21f37525c923d4f19997121574f65b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//
//  NSDictionary+SafeRemove.h
//  SmartDeviceLink-iOS
//
//  Created by Joel Fischer on 7/21/16.
//  Copyright © 2016 smartdevicelink. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface NSMutableDictionary <KeyType, ObjectType>
(SafeRemove)

    /**
 *  Safely attempt to remove a key/object pair by no-oping if they don't exist in the Mutable Dictionary instead of throwing an exception
 *
 *  @param aKey The key to attempt removal of
 *
 *  @return Whether or not the key/object pair existed to remove.
 */
    - (BOOL)safeRemoveObjectForKey : (KeyType)aKey;

@end

@interface NSMapTable <KeyType, ObjectType>
(SafeRemove)

    /**
 *  Safely attempt to remove a key/object pair by no-oping if they don't exist in the MapTable instead of throwing an exception
 *
 *  @param aKey The key to attempt removal of
 *
 *  @return Whether or not the key/object pair existed to remove.
 */
    - (BOOL)safeRemoveObjectForKey : (KeyType)aKey;

@end