In this video, we will provide custom sorting order for the Java's TreeSet. We do this by implementing the Comparator interface in an external class and handing over that to TreeSet. The video shows custom sorting of the Product class by Product ID in Descending Order using the Comparator Interface. Note, the TreeSet here is the Collection of Product instances.
00:00 Introduction
00:14 Comparator Interface
02:45 Compare Method
08:45 Demo - About Product Class
09:53 Demo - TreeSetNumer Class
10:43 Demo - Implement Comparator Interface
17:25 Demo - Create TreeSet with Comparator
21:27 Demo - See How Custom Sort Works
Sur cette page du site, vous pouvez voir la vidéo en ligne Java Collections - Custom Sorting by Comparator Interface | Java Tutorial Part 1 durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Coding Examples 30 juin 2020, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 595 fois et il a aimé 10 téléspectateurs. Bon visionnage!