Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在寻找这样的存储阵列方式:
array['name'] or array.add('name','value').
arrayList 不能那样工作。像这样存储值的最佳方法是什么?
使用Map. AHashMap是一个不错的选择:
Map
HashMap
Map<String, String> map = new HashMap<String, String>(); // to add name/value pairs - like your array.add('name','value') map.put("name", "value"); // to retrieve values - like your array['name'] map.get("name");