K kenten123 Member Licensed User Longtime User Mar 23, 2014 #1 Is there any way to do a reverse lookup in a map (or list). Given that I know a Value is there a way to find the corresponding Key directly - that is, without iterating over all indexes ? Thanks for any help. Ken
Is there any way to do a reverse lookup in a map (or list). Given that I know a Value is there a way to find the corresponding Key directly - that is, without iterating over all indexes ? Thanks for any help. Ken
Erel B4X founder Staff member Licensed User Longtime User Mar 23, 2014 #2 You can use List.IndexOf or iterate over the values in a Map. The operation cost is the same - O(n). If the Map is very large then you can use two maps. One with the keys as keys and one with the values as keys. Upvote 0
You can use List.IndexOf or iterate over the values in a Map. The operation cost is the same - O(n). If the Map is very large then you can use two maps. One with the keys as keys and one with the values as keys.
K kenten123 Member Licensed User Longtime User Mar 23, 2014 #3 Thanks. I'll go with two maps Upvote 0