地图地图 - 如何将内部地图保留为地图?
问题描述
我的目标是创建一个地图地图,以便我可以通过其键检索外部地图的信息,然后通过其键访问其内部"地图.
My goal is to create a map of maps so that I can retrieve info of the outer map by its key and then access its "inner" maps by their keys.
但是,当我得到每个内部地图时,我最初创建的地图变成了一个对象,我不能像使用外部地图那样使用键来访问它的值.
However, when I got each inner map, the map I created originally became an Object and I cannot use key to access its value as I do with the outer map.
为了向各位专家学习,我想知道如何将所有地图保留为地图.或者,有可能吗?
To learn from you experts, I would like to know how to keep all the maps as maps. Or, is it possible at all?
这是我的锻炼计划:
解决方案:
阿米尔和斯莱斯克
推荐答案
这是更新后的代码,似乎可以工作,您需要将地图的地图键入为 <String, Object>
因为mp 不是你不能做的字符串 <Object, String>
.
Here is the updated code that seems to work, you need to type the map of maps as <String, Object>
since mp isn't a string you can't do <Object, String>
.
这篇关于地图地图 - 如何将内部地图保留为地图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!