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
In questa pagina del sito puoi guardare il video online Java Collections - Custom Sorting by Comparator Interface | Java Tutorial Part 1 della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Coding Examples 30 giugno 2020, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 595 volte e gli è piaciuto 10 spettatori. Buona visione!