public class IntHashMap<T> extends Object
| Modifier and Type | Class and Description | 
|---|---|
| protected static class  | IntHashMap.Entry<T>代表hash表中的一个元素的类。 | 
| Constructor and Description | 
|---|
| IntHashMap()创建一个hash表,使用默认的初始容量 16和默认的负载系数0.75。 | 
| IntHashMap(int initialCapacity)创建一个hash表,使用指定的初始容量和默认的负载系数 0.75。 | 
| IntHashMap(int initialCapacity,
          float loadFactor)创建一个hash表,使用默认的指定的初始容量和指定的负载系数。 | 
| Modifier and Type | Method and Description | 
|---|---|
| void | clear()清除hash表。 | 
| boolean | containsKey(int key)查看hash表中是否存在指定的key。 | 
| boolean | containsValue(Object value)查看hash表中是否存在指定的值。 | 
| T | get(int key)从hash表中取得和指定key对应的值。 | 
| protected int | getCapacity()取得hash表的容量。 | 
| protected int | getThreshold()取得hash表的阈值。 | 
| boolean | isEmpty()测试hash表是否为空。 | 
| int[] | keys() | 
| T | put(int key,
   T value)将key和指定对象相关联,并保存在hash表中。 | 
| protected void | rehash()重构hash表,倍增其容量。 | 
| T | remove(int key)从hash表中删除一个值。 | 
| int | size()取得当前hash表中元素的个数。 | 
| String | toString()取得字符串表示。 | 
public IntHashMap()
16和默认的负载系数0.75。public IntHashMap(int initialCapacity)
0.75。initialCapacity - hash表的初始容量IllegalArgumentException - 如果初始容量小于或等于0public IntHashMap(int initialCapacity,
                  float loadFactor)
initialCapacity - hash表的初始容量loadFactor - 负载系数IllegalArgumentException - 如果初始容量小于或等于0,或负载系数不是正数public int size()
public boolean isEmpty()
truepublic boolean containsKey(int key)
key - 要搜索的keytruepublic boolean containsValue(Object value)
value - 要搜索的值truepublic T get(int key)
key - 要查找的keynullpublic T put(int key, T value)
key - 对象的keyvalue - 对象(值)public T remove(int key)
key - 要删除的值所对应的keypublic void clear()
public int[] keys()
protected void rehash()
protected int getCapacity()
protected int getThreshold()
Copyright © 2006–2018 TinyGroup. All rights reserved.