Usually, if I know all the keys of the card in advance, I create it like this:
List<String> someKeyList = getSomeList(); Map<String, Object> someMap = new HashMap<String, Object>(someKeyList.size()); for (String key : someKeyList) { someMap.put(key, null); }
Is there a way to do this directly without requiring repetition on the list? Sort of:
new HashMap<String, Object>(someKeyList)
My first thought was to edit the map set directly, but the operation is not supported. Is there any other way that I skip?
source share