New course! Every coder should learn Generative AI!
Try a free lesson+ 1
When do we use Sets or Lists in Java?
sets or Lists java
1 Answer
+ 4
List can contain duplicate elements and Set can not. Also Set elements cannot be accessed by index. So your choice here depends of your task.