HashMap<String,String>
是什么意思?当我调用 map.get("key") 并且我在 HashMap 中没有键为“key”的条目时返回?
最佳答案
它返回 null
。写在 documentation .
Returns: the value to which the specified key is mapped, or null if this map contains no mapping for the key
当您有这样一个具体问题时,首先要做的是查阅文档。 Java API 的文档很好,可以告诉您返回的内容、抛出的异常以及每个参数的含义。
关于java - 无键时从 HashMap<String, String> 返回,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5220619/