Map value類型不同的寫法 Map<String, Object> accountMap=new HashMap<String, Object>(); int userId = data.get("userId").getAsInt(); int accType = data.get("accType").getAsInt();String name = data.get("accType").getAsString();accountMap.put("userId",userId); accountMap.put("accType",accType);accountMap.put("name ",name );Integer userId= (Integer) accountMap.get("userId"); String name = (String) accountMap.get("name"); 要么強制轉換,要么value只能存一種類型
?