Java 中的 HashMap 不工作

HashMap in Java Not Working

这是我在 Java 编码的第二天,尽管我对编码并不陌生,但请不要担心。无论如何,我不习惯没有像 Python 这样的字典,它可以存储 KeyValue.

那是我遇到 Java HashMap 的时候。目前,我似乎无法让他们工作,我不确定为什么。这是我正在使用的代码,但这些似乎引发了错误:

 Map<String, String> visual = new HashMap<String, String>();

那么这是它生成的错误:

Multiple markers at this line
    - The type Map is not generic; it cannot be parameterized with arguments <String, String>
    - HashMap cannot be resolved to a type

我什至正在导入哈希库:

import java.util.Map;
import java.util.HashMap;

所以我的问题很简单,为什么 HashMap 不起作用?谢谢! :)


P.S。这是我的一小段代码:

public Map areaTotal() {
    Map<String, String> visual = new HashMap<String, String>();
    return visual;
}

编辑

抱歉,我想我确实忘了包含一些其他信息。

您可能在同一个包中还有另一个 Map class,它不是通用的 - 这应该被删除或重命名为其他东西

重新启动 Eclipse 一次。对我有用。