Map value类型不同的写法
生活随笔
收集整理的這篇文章主要介紹了
Map value类型不同的写法
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
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只能存一種類型
?
轉載于:https://www.cnblogs.com/thiaoqueen/p/6857943.html
總結
以上是生活随笔為你收集整理的Map value类型不同的写法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 一篇介绍VC开发OCX的文章,写得太棒了
- 下一篇: 51中断实验与流水灯protues仿真