java - 如何查找hashmap中是否有空键?

标签 java collections

<分区>

谁能告诉我如何找到 HashMap 是否包含空键。

最佳答案

尝试结合使用 containsKey== null

像这样:

if (map.containsKey("your_key") && map.get("your_key") == null) {
   // your map contains a key, and it is null
}

关于java - 如何查找hashmap中是否有空键?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48585630/

相关文章:

java - Android单例变为null

java - 在 Blackberry 上使用 Google Spreadsheet API

java - 运行用 Kotlin 编写的 Apache Tomcat servlet 时出错

java - JTabbedPane 自动加载组件

java com.mongodb.DBCollection 创建后台索引

java - log4j2 未检测到自定义附加程序插件

java - String 数组是 Object 数组的子类吗?

c# - WPF 绑定(bind)到对象集合,按顺序存储在 C# 中的另一个集合中的 ID 排序

C#:为什么 LinkedList 没有采用谓词的 RemoveAll 方法?

android - 如何查看变化的集合?