Hello everyone,
Welcome to ModelMyMind, your channel for Java programming.
Since Java version 8, Java has become a fantastic programming language. Version 8 introduced several improvements, including to the Comparator interface. These include some static functions that make life easier for us programmers when sorting objects in collections.
If you want to see how practical the Comparator interface has become, then watch this video.
Instead of writing large CompareTo methods in a Comparable class or implementing the Comparator interface's CompareMethod extensively, different Comparators can be defined on demand with minimal code.
As you probably already know, the most important use case for comparing two objects is certainly sorting objects in lists or arrays.
I hope you enjoy this video.
Coffee fund:
https://www.paypal.com/paypalme/mmmsde
#java #programming #comparator
0:00 - Intro
0:35 - Warm-up: Comparator
01:42 - Sorting: Integer values in lists
03:29 - Sorting: String values in lists
04:26 - Sorting: Objects in lists