InterviewSolution
Saved Bookmarks
| 1. |
Differentiate between Set and Map in Java. |
||||||||
|
Answer» The Set interface is provided by the Java.util package. The set interface is established by extending the COLLECTION interface. We can't add the same element to it since it won't let US. Because it contains elements in a sorted order, it does not keep the insertion order. The Set interface in Java is used to build the MATHEMATICAL Set. Map is SIMILAR to Set in that it is used to store a collection of objects as a single entity. A KEY-value pair is used to store each object. Because each value is associated with a unique key, we can quickly obtain the value using just the key.
|
|||||||||