Question d’entretien chez Revature

What is the difference between a set and a map?

Réponses aux questions d'entretien

Utilisateur anonyme

10 déc. 2020

List allows duplicate elements. Any number of duplicate elements can be inserted into the list without affecting the same existing values and their indexes. Set doesn’t allow duplicates. Set and all of the classes which implements Set interface should have unique elements. Map stored the elements as key & value pair. Map doesn’t allow duplicate keys while it allows duplicate values.

11

Utilisateur anonyme

31 juil. 2021

Both are used to store a collection of objects as a single unit. The main difference between a Set and a Map is that the set is unordered and contain different elements, whereas MAP contains the data in the key-value par.

1