Which collection one should choose in case when we need output in a descending format?and Why? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

Which collection one should choose in case when we need output in a descending format?and Why?

There is a black box to whom input is a stream of distinct integers and I need output in descending sorted format which is the ideal collection for it and why?

2nd May 2019, 7:45 AM
Alex Mendes
Alex Mendes - avatar
1 Réponse
+ 1
I think sorted set is what you after https://docs.oracle.com/javase/7/docs/api/java/util/SortedSet.html It contains only distinct elements in some order.
2nd May 2019, 8:08 AM
Dima Makieiev
Dima Makieiev - avatar