【问题标题】:What is wrong about HashmapHashmap 有什么问题
【发布时间】:2016-05-02 04:54:23
【问题描述】:

我在 Android Studio 1.7 版中使用 Hashmap。 但我正在关注旧网站的代码。 我不知道新Hashmap 的新平台。 我可以运行应用程序。在 logcat 中没有错误。 请看我的照片并帮助我。 对不起我的英语不好。

【问题讨论】:

  • 这里没有错。在 Java 7 或更高版本中,您可以使用一组空的类型参数 () 来调用泛型类的构造函数。示例:Box integerBox = new Box();

标签: android sqlite android-studio compiler-errors hashmap


【解决方案1】:

这并没有错。 Android Studio 显示的对话框只是提示您可以将其编写得更简单一些。

【讨论】:

    【解决方案2】:

    尝试通过以下方式初始化您的Arraylist

    ArrayList<HashMap<String,String>> MyArrList = new ArrayList<>();
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-10-13
      • 2011-04-22
      • 1970-01-01
      • 1970-01-01
      • 2021-06-09
      • 2014-08-12
      相关资源
      最近更新 更多