我想在java中创建一个3维数组,其中前两个维度是索引(0-100)和(0-4),第三个维度是字典索引(12、18、22、49等) )
我该如何设置?我想:
HashMap<Integer, Integer>[][] mem;
mem = new HashMap<Integer, Integer>[101][5];
但是我收到错误。我的做法正确吗?
谢谢!
最佳答案
为什么不使用类来包装 HashMap?
class Dictionary {
HashMap<Integer, Integer> map = new HashMap<>();
}
Dictionary[][] mem = new Dictionary[101][5];
关于java - 在java中创建HashMap的二维数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33061027/