Hashtable associates keys with values. Both keys and values cannot be null. The size of the Hashtable is the number of key/value pairs it contains. The capacity is the number of key/value pairs the Hashtable can hold. The load factor is a float value which determines how full the Hashtable gets befo
| 33 | */ |
| 34 | |
| 35 | public class Hashtable<K, V> extends Dictionary<K, V> implements Map<K, V> { |
| 36 | transient int elementCount; |
| 37 | |
| 38 | transient Entry<K, V>[] elementData; |
| 39 | |
| 40 | private float loadFactor; |
| 41 | |
| 42 | private int threshold; |
| 43 | |
| 44 | transient int firstSlot; |
| 45 | |
| 46 | transient int lastSlot = -1; |
| 47 | |
| 48 | transient int modCount; |
| 49 | |
| 50 | private static final java.util.Enumeration<?> EMPTY_ENUMERATION = new java.util.Enumeration<Object>() { |
| 51 | public boolean hasMoreElements() { |
| 52 | return false; |
| 53 | } |
| 54 | |
| 55 | public Object nextElement() { |
| 56 | throw new NoSuchElementException(); |
| 57 | } |
| 58 | }; |
| 59 | |
| 60 | private static final Iterator<?> EMPTY_ITERATOR = new Iterator<Object>() { |
| 61 | |
| 62 | public boolean hasNext() { |
| 63 | return false; |
| 64 | } |
| 65 | |
| 66 | public Object next() { |
| 67 | throw new NoSuchElementException(); |
| 68 | } |
| 69 | |
| 70 | public void remove() { |
| 71 | throw new IllegalStateException(); |
| 72 | } |
| 73 | }; |
| 74 | |
| 75 | private static <K, V> Entry<K, V> newEntry(K key, V value, int hash) { |
| 76 | return new Entry<K, V>(key, value); |
| 77 | } |
| 78 | |
| 79 | private static class Entry<K, V> extends MapEntry<K, V> { |
| 80 | Entry<K, V> next; |
| 81 | |
| 82 | final int hashcode; |
| 83 | |
| 84 | Entry(K theKey, V theValue) { |
| 85 | super(theKey, theValue); |
| 86 | hashcode = theKey.hashCode(); |
| 87 | } |
| 88 | |
| 89 | @Override |
| 90 | public V setValue(V object) { |
| 91 | if (object == null) { |
| 92 | throw new NullPointerException(); |
nothing calls this directly
no outgoing calls
no test coverage detected