Comparator Interface Tutorial in Java - for beginners. Explained simply and elegantly in under 5 minutes.
Today I am going to show you how to use the Comparator interface in Java to sort Custom objects using the
A comparison function, which imposes a total ordering on some collection of objects. Comparators can be passed to a sort method (such as Collections.sort or Arrays.sort) to allow precise control over the sort order. Comparators can also be used to control the order of certain data structures (such as sorted sets or sorted maps), or to provide an ordering for collections of objects that don't have a natural ordering.
Ещё видео!