R Roger Garstang Well-Known Member Licensed User Longtime User Nov 14, 2012 #1 I have a LinkedHashMap and want to return a copy of it as a B4A Map and created this method below which appears to work, but is it the best/only way to do it? One version of the LinkedHashMap constructor has a way to pass a LinkedHashMap in to build off of, and I thought B4A's Map/MyMap inherited from it, but it doesn't have a constructor like this. Code: Copy /** * Returns the Named Views in a Map. */ public Map GetViews(){ Map newMap = new Map(); MyMap newViewMap = new MyMap(); newViewMap.putAll(viewList); newMap.setObject(newViewMap); return newMap; } Last edited: Nov 14, 2012
I have a LinkedHashMap and want to return a copy of it as a B4A Map and created this method below which appears to work, but is it the best/only way to do it? One version of the LinkedHashMap constructor has a way to pass a LinkedHashMap in to build off of, and I thought B4A's Map/MyMap inherited from it, but it doesn't have a constructor like this. Code: Copy /** * Returns the Named Views in a Map. */ public Map GetViews(){ Map newMap = new Map(); MyMap newViewMap = new MyMap(); newViewMap.putAll(viewList); newMap.setObject(newViewMap); return newMap; }