Way to check a map for a value without iterating?

mistermentality

Active Member
Licensed User
Longtime User
I have a map file which when full can have thousands of entries in it, all in the form of numbers eg key 1=1 value 1=4 for example.

If I have a number (for example 5) and I want to see if it is stored somewhere in a maps values, is there a way to do it without iterating over every key and value pair. I don't need to know where it is stored (eg is it value 1, value 2 etcetera) just whether it is stored in the values at all.

So for example if I want to see if the number 22 is stored anywhere in the values of a map called map1 is there a way to do this, or will I need to iterate over each map entry?

Thanks

David
 

rossati

Active Member
Licensed User
Longtime User
A cumbersome method

Hello

If you have memory you can create a secon map where the key is your number:

if map2.ContainsKey("5") then


John Rossati
 
Upvote 0
Top