Types | Synchronized | Unsynchronized |
---|---|---|
Hashtable | Y | - |
HashMap | - | Y |
Vector | Y | - |
ArrayList | - | Y |
StringBuffer | Y | - |
StringBuilder | - | Y |
Saturday, April 6, 2013
Synchronized and Unsynchronized Types in Java
Hashtable & HashMap & HashSet
Hashtable
HashMap
HashSet
- A table of records
- Stores key-value pairs
- Implements Map interface
- Does not allow null key
- Does not allow null values
- Synchronized
HashMap
- Stores key-value pairs
- Implements Map interface
- Allows null key (at most one)
- Allows null values (arbitrary number)
- Unsynchronized
HashSet
- A collection of elements
- Implements Set interface
- Allows null element (at most one)
- Unsynchronized
Subscribe to:
Posts (Atom)