Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Collection<E> and Set<E> are the same?

I have a question about those two interfaces in Java. Set extends Collection, but doesn't add anything. They are exactly the same. Am I missing something here ?

like image 576
Yaron Levi Avatar asked Nov 29 '22 17:11

Yaron Levi


1 Answers

Set doesn't allow duplicates.

It's a semantic difference, not a syntactic one.

like image 164
Vito De Tullio Avatar answered Dec 04 '22 12:12

Vito De Tullio