Hashtable is a synchronized implementation of Map. All optional operations are supported. Neither keys nor values can be null. (Use HashMap or LinkedHashMap if you need null keys or values.) @param the type of keys maintained by this map @param the type of mapped
| 35 | * @see HashMap |
| 36 | */ |
| 37 | public class Hashtable<K, V> extends Dictionary<K, V> |
| 38 | implements Map<K, V>, Cloneable, Serializable { |
| 39 | /** |
| 40 | * Min capacity (other than zero) for a Hashtable. Must be a power of two |
| 41 | * greater than 1 (and less than 1 << 30). |
| 42 | */ |
| 43 | private static final int MINIMUM_CAPACITY = 4; |
| 44 | |
| 45 | /** |
| 46 | * Max capacity for a Hashtable. Must be a power of two >= MINIMUM_CAPACITY. |
| 47 | */ |
| 48 | private static final int MAXIMUM_CAPACITY = 1 << 30; |
| 49 | |
| 50 | /** |
| 51 | * An empty table shared by all zero-capacity maps (typically from default |
| 52 | * constructor). It is never written to, and replaced on first put. Its size |
| 53 | * is set to half the minimum, so that the first resize will create a |
| 54 | * minimum-sized table. |
| 55 | */ |
| 56 | private static final Entry[] EMPTY_TABLE |
| 57 | = new HashtableEntry[MINIMUM_CAPACITY >>> 1]; |
| 58 | |
| 59 | /** |
| 60 | * The default load factor. Note that this implementation ignores the |
| 61 | * load factor, but cannot do away with it entirely because it's |
| 62 | * mentioned in the API. |
| 63 | * |
| 64 | * <p>Note that this constant has no impact on the behavior of the program, |
| 65 | * but it is emitted as part of the serialized form. The load factor of |
| 66 | * .75 is hardwired into the program, which uses cheap shifts in place of |
| 67 | * expensive division. |
| 68 | */ |
| 69 | private static final float DEFAULT_LOAD_FACTOR = .75F; |
| 70 | |
| 71 | /** |
| 72 | * The hash table. |
| 73 | */ |
| 74 | private transient HashtableEntry<K, V>[] table; |
| 75 | |
| 76 | /** |
| 77 | * The number of mappings in this hash map. |
| 78 | */ |
| 79 | private transient int size; |
| 80 | |
| 81 | /** |
| 82 | * Incremented by "structural modifications" to allow (best effort) |
| 83 | * detection of concurrent modification. |
| 84 | */ |
| 85 | private transient int modCount; |
| 86 | |
| 87 | /** |
| 88 | * The table is rehashed when its size exceeds this threshold. |
| 89 | * The value of this field is generally .75 * capacity, except when |
| 90 | * the capacity is zero, as described in the EMPTY_TABLE declaration |
| 91 | * above. |
| 92 | */ |
| 93 | private transient int threshold; |
| 94 |
nothing calls this directly
no outgoing calls
no test coverage detected