Map
- To represent group of objects as key value pairs
- NOT a child interface of Collection Interface
- Therefore, strictly speaking, Collection Interface is NOT root interface of Collection framework
- Duplicates
- Keys - Duplicates - NOT Allowed
- Values - Duplicates - Allowed
HashMap vs Hashtable
HashMap | Hashtable | |
---|---|---|
Introduced in | 1.2 | 1.0 |
Thread Safety | Not thread safe (not synchronized) => works with single thread | Thread safe (synchronized) => works with multiple threads |
Speed | Faster | Slower |
Null key | One null key allowed | Null key not allowed |
Child classes/interfaces:
Children
Backlinks