InterviewSolution
| 1. |
Differentiate between List and Set in Java. |
||||||||||
|
Answer» The LIST interface is used to keep track of an ordered collection. It is the Collection's child interface. It is an ordered collection of objects that allows for the storage of DUPLICATE values. The insertion order is preserved in a list, which enables positional access and ELEMENT insertion. The set interface is PART of java.util package and extends the Collection interface. It is an unordered collection of objects in which duplicate values cannot be stored. It's an interface for using the mathematical set. This interface inherits the Collection interface's METHODS and adds a feature that prevents duplicate elements from being inserted.
|
|||||||||||