Hashtable
Learn Hashtable (Map Interface, Collection Framework) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.
What is a Hashtable? Hashtable is the original (Java 1.0) key-value store . It works like a HashMap but every method is synchronized , and it refuses null keys and values. Today it is a legacy class : you will meet it in old code and interviews, but new code should use HashMap (single thread) or ConcurrentHashMap (many threads). Package java.util . Extends the old Dictionary class and implements Map . Thread-safe : each method locks the whole table, so only one thread works at a time. No null key and no null value : put(null, x) and put(k, null) throw NullPointerException . No guaranteed order...