Cocoa provides NSDictionary, which essentially is an associative array.
Is there a nice way to get bidirectional associativity? i.e. one way would have been if NSDictionary had a keyForObject:
method which mirrored the behavior of objectForKey:
.
I don't really care if NSDictionary is not the way to get this. I know NSDictionary does provide keysOfEntriesPassingTest:
but it returns an NSSet *
which doesn't look very clean for the kind of thing I want to have.
Here is an example:
fieldMap = [[NSDictionary alloc] initWithObjectsAndKeys:
@"c0",@"synckey",
@"c1",@"wi_id",
@"c2",@"wi_parent_id",
@"c3",@"wi_type",
@"c4",@"wi_rh_task",
@"c5",@"decision_key",
@"c6",@"wi_stat",
@"c7",@"wi_prio",
@"c8",@"wi_cd",
@"c9",@"wi_ct",
@"cb",@"wi_dh_stat",
@"cc",@"wi_user",
nil];
I want to translate between c0 and synckey and back, and ditto for the other fields.