You need to sign in to do that
Don't have an account?
Wtf with maps??? 0_o
code part:
Map<String,PropertyType> SelectedItems = new Map<String,PropertyType>(); for(oneProperty oneProp : DisplaiedProperties) { System.Debug('_____________________'+oneProp.PropertyValue+'_______________'+oneProp.PType); SelectedItems.put(oneProp.PropertyValue,oneProp.PType); } for(string b:SelectedItems.keySet()) { System.Debug('_____________________'+b+'_______________'+SelectedItems.get(b)); }
and part of debug log:
9:58:31.506|USER_DEBUG|[461,4]|DEBUG|_____________________Name_______________TheString
9:58:31.506|METHOD_EXIT|[461,4]|System.Debug(String)
9:58:31.506|METHOD_ENTRY|[462,4]|MAP<String,Select_Filtered_Popup_controller.PropertyType>.put(String, Select_Filtered_Popup_controller.PropertyType)
9:58:31.506|METHOD_EXIT|[462,4]|MAP<String,Select_Filtered_Popup_controller.PropertyType>.put(String, Select_Filtered_Popup_controller.PropertyType)
9:58:31.506|METHOD_ENTRY|[461,4]|System.Debug(String)
9:58:31.507|USER_DEBUG|[461,4]|DEBUG|_____________________Phone_______________TheString
9:58:31.507|METHOD_EXIT|[461,4]|System.Debug(String)
9:58:31.507|METHOD_ENTRY|[462,4]|MAP<String,Select_Filtered_Popup_controller.PropertyType>.put(String, Select_Filtered_Popup_controller.PropertyType)
9:58:31.507|METHOD_EXIT|[462,4]|MAP<String,Select_Filtered_Popup_controller.PropertyType>.put(String, Select_Filtered_Popup_controller.PropertyType)
9:58:31.507|METHOD_ENTRY|[461,4]|System.Debug(String)
9:58:31.507|USER_DEBUG|[461,4]|DEBUG|_____________________BillingCountry_______________TheString
9:58:31.507|METHOD_EXIT|[461,4]|System.Debug(String)
9:58:31.507|METHOD_ENTRY|[462,4]|MAP<String,Select_Filtered_Popup_controller.PropertyType>.put(String, Select_Filtered_Popup_controller.PropertyType)
9:58:31.507|METHOD_EXIT|[462,4]|MAP<String,Select_Filtered_Popup_controller.PropertyType>.put(String, Select_Filtered_Popup_controller.PropertyType)
9:58:31.507|METHOD_ENTRY|[467,16]|MAP<String,Select_Filtered_Popup_controller.PropertyType>.keySet()
9:58:31.507|METHOD_EXIT|[467,16]|MAP<String,Select_Filtered_Popup_controller.PropertyType>.keySet()
9:58:31.507|METHOD_ENTRY|[469,6]|System.Debug(String)
9:58:31.507|METHOD_ENTRY|[469,63]|MAP<String,Select_Filtered_Popup_controller.PropertyType>.get(String)
9:58:31.507|METHOD_EXIT|[469,63]|MAP<String,Select_Filtered_Popup_controller.PropertyType>.get(String)
9:58:31.507|USER_DEBUG|[469,6]|DEBUG|_____________________Name_______________TheString
9:58:31.507|METHOD_EXIT|[469,6]|System.Debug(String)
9:58:31.507|METHOD_ENTRY|[469,6]|System.Debug(String)
9:58:31.507|METHOD_ENTRY|[469,63]|MAP<String,Select_Filtered_Popup_controller.PropertyType>.get(String)
9:58:31.507|METHOD_EXIT|[469,63]|MAP<String,Select_Filtered_Popup_controller.PropertyType>.get(String)
9:58:31.507|USER_DEBUG|[469,6]|DEBUG|_____________________BillingCountry_______________TheString
9:58:31.507|METHOD_EXIT|[469,6]|System.Debug(String)
9:58:31.507|METHOD_ENTRY|[469,6]|System.Debug(String)
9:58:31.507|METHOD_ENTRY|[469,63]|MAP<String,Select_Filtered_Popup_controller.PropertyType>.get(String)
9:58:31.507|METHOD_EXIT|[469,63]|MAP<String,Select_Filtered_Popup_controller.PropertyType>.get(String)
9:58:31.507|USER_DEBUG|[469,6]|DEBUG|_____________________Phone_______________TheString
How can i simply walk throught the Map in right direction???
Here's a line from Apex Documentation:
Do not rely on the order in which map results are returned. The order of objects returned by maps may change without warning. Always access map elements by key.
http://www.salesforce.com/us/developer/docs/apexcode/index.htm
Does that help?
I'am realy confused by this. I mean that opportunitiy to direct walking throught data set(any data set) is the one of the basiс requirement of hi-level programming language. :smileysad:
In this way construction is nearly to be unuseful. mde=(
You can walk through the data set, you just can't walk through the data set in any order (e.g. the order that you added them). If you need ordering, I'd suggest that you maintain a seperate list of Strings containing the keys from the map. As the list is ordered, you can then iterate the list to retrieve the keys in the order you added them, and then lookup the value associated with the key in the map.
It is possible (in a general algorithmic sense, not in apex) to have a sorted map, where an iterator over the map will iterate in an order derived by comparing the keys. This would require a different type of data structure than the common hashtable, which is what apex uses as its map implementation. An example of this is Java's TreeMap. The trouble with sorted maps is that there is a performance penalty to pay. TreeMap insertions are not done in constant time, for example. This could have serious impact on apex programs that create maps from large query result sets.
At any rate, it is highly common for maps in any language to not have the property of being sorted.
Rich