Java Data Structures Interview Questions
The Collection Types
Set: A set has no duplicates. It also has no guaranteed order. Because of this, it does not provide positional access. Implements Collection. Example implementations include TreeSet and HashSet.
List: A list may or may not contain duplicates and also guarantees order and allows positional access. Implements Collection. Example implementations include ArrayList and LinkedList.
Map (interface: AbstractMap): A map is slightly different as it contains key-value pairs as opposed to specific object. The key of a map may not contain duplicates. A map has no guaranteed order and no positional access. Does not implement Collection. Example implementations include HashMap and TreeMap.
But what does this mean with regards to interviews? You're almost certainly going to get a question about the differences between these which make it easy enough to remember by wrote. More importantly the smart interviewee understands what the implication of these facets are. Why would you choose one over the other? What are the implications?
Read full article from Java Data Structures Interview Questions
No comments:
Post a Comment