Java Question Best Way to return a Map from a LinkedHashMap

Roger Garstang

Well-Known Member
Licensed User
Longtime User
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.

B4X:
/**
* 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:
Top