当前位置: 技术问答>java相关
请问哪个方法可以检查Map中有某个键存在?
来源: 互联网 发布时间:2017-03-09
本文导语: 谢谢 | Map.containsKey(Object key) Returns true if this map contains a mapping for the specified key 试验一下这个方法 | java.util Interface Map containsKey public boolean containsKey(Object key) Retu...
谢谢
|
Map.containsKey(Object key)
Returns true if this map contains a mapping for the specified key
试验一下这个方法
Returns true if this map contains a mapping for the specified key
试验一下这个方法
|
java.util
Interface Map
containsKey
public boolean containsKey(Object key)
Returns true if this map contains a mapping for the specified key. More formally, returns true if and only if this map contains at a mapping for a key k such that (key==null ? k==null : key.equals(k)). (There can be at most one such mapping.)
Parameters:
key - key whose presence in this map is to be tested.
Returns:
true if this map contains a mapping for the specified key.
Throws:
ClassCastException - if the key is of an inappropriate type for this map (optional).
NullPointerException - if the key is null and this map does not not permit null keys (optional).
Interface Map
containsKey
public boolean containsKey(Object key)
Returns true if this map contains a mapping for the specified key. More formally, returns true if and only if this map contains at a mapping for a key k such that (key==null ? k==null : key.equals(k)). (There can be at most one such mapping.)
Parameters:
key - key whose presence in this map is to be tested.
Returns:
true if this map contains a mapping for the specified key.
Throws:
ClassCastException - if the key is of an inappropriate type for this map (optional).
NullPointerException - if the key is null and this map does not not permit null keys (optional).
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。