Write Efficient Bug-free and Simple Comparators in Java - JEP Café #17
José Paumard on February 21, 2023Comparator are elements used daily in all Java applications. There are fairly easy to write, but must also follow several subtle rules. This JEP Café explains all of them: how to leverage the factory methods from the Comparator interface, and from the wrapper classes of primitive types. We also cover even more subtle and unexpected bugs you may come across with HashSet and HashMap if your comparators are not consistent.
Make sure to check the show-notes!