码迷,mamicode.com
首页 > 其他好文 > 详细

HashMap

时间:2020-02-14 10:50:09      阅读:47      评论:0      收藏:0      [点我收藏+]

标签:ecif   spec   ret   常用   构造   extend   object   this   cap   

Class HashMap<K,V>

1.包:java.util;

2.K-键,V-值

3.构造方法:

HashMap();

HashMap(int initialCapacity)

HashMap(int initialCapacity,float loadFactor)

HashMap(Map<?extends K,?extends V>m)

4.常用方法:

(1)clear() 

Removes all of the mappings from this map

(2)containsKey(Object key)

Returns true if this map contains a mapping for the specified key.

(3)containsValue(Object value)

Returns true if this map maps one or more keys to the specified value.

(4)get(Object key)

Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.

(5)isEmpty()

Returns true if this map contains no key-value mappings.

(6)put(K key,V value)

Associates the specified value with the specified key in this map.

(7)size()

Returns the number of key-value mappings in this map.

 

HashMap

标签:ecif   spec   ret   常用   构造   extend   object   this   cap   

原文地址:https://www.cnblogs.com/bitreea/p/12306314.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!