Java 我收到一个字符串数组,并希望根据数组中收到的字符串访问hashmap
我得到这个错误: 错误:找不到符号 布尔tmp=cardNames[i].getstoreType; ^ 符号:方法getString 位置:类字符串Java 我收到一个字符串数组,并希望根据数组中收到的字符串访问hashmap,java,hashmap,Java,Hashmap,我得到这个错误: 错误:找不到符号 布尔tmp=cardNames[i].getstoreType; ^ 符号:方法getString 位置:类字符串 我相信你能做的就是为你所有的地图准备一张地图,地图上的名字是关键 大概是这样的: for(int i=0;i<cardNames.length;i++){ boolean tmp = cardNames[i].containsKey(storeType); 这里的名片和存储类型是什么? for(int i=0;i
我相信你能做的就是为你所有的地图准备一张地图,地图上的名字是关键 大概是这样的:
for(int i=0;i<cardNames.length;i++){
boolean tmp = cardNames[i].containsKey(storeType);
这里的名片和存储类型是什么?
for(int i=0;i<arr.length;i++){
System.out.println(arr[i].get("value"));
// basically, arr[i] is the hashmap name and I want to access it
}
for(int i=0;i<cardNames.length;i++){
boolean tmp = cardNames[i].containsKey(storeType);
Map<String, Map<String,Integer>> superHashMap = new HashMap<>();
String arr[] = {"hashmap1", "hashmap2"};
Hashmap<String,Integer> hashmap1;
Hashmap<String,Integer> hashmap2;
superHashMap.put("hashmap1", hashmap1);
superHashMap.put("hashmap2", hashmap2);
How can I do this:
for(int i=0;i<arr.length;i++){
// This shall contain the desired hashMap that you would need for further processing.
Map<String, Integer> mapYouNeedToAccess = superHashMap.get(arr[i]);
}