Hi. Some guidance please. How can i cast a java.util.HashMap object into a b4a map ? TIA Nelson
vpires Member Licensed User Longtime User Nov 15, 2013 #1 Hi. Some guidance please. How can i cast a java.util.HashMap object into a b4a map ? TIA Nelson
Erel B4X founder Staff member Licensed User Longtime User Nov 17, 2013 #2 You can use this code: B4X: private static Map convertToMap(HashMap<?, ?> javaMap) { Map m = new Map(); m.Initialize(); for (Entry<?, ?> e : javaMap.entrySet()) { m.Put(e.getKey(), e.getValue()); } return m; }
You can use this code: B4X: private static Map convertToMap(HashMap<?, ?> javaMap) { Map m = new Map(); m.Initialize(); for (Entry<?, ?> e : javaMap.entrySet()) { m.Put(e.getKey(), e.getValue()); } return m; }