Comparison Method Violates Its General Contract! (Part 2) by Stuart Marks
3,307 views · Published 8 November 2017 · 30:24 · Indexed 1 November 2026
Channel: Devoxx · 2017 · Science & Technology
Why does sorting sometimes throw this exception? What does it mean? And why does it sometimes occur and sometimes work fine? The answer is in the Comparator interface. A Comparator has one task: to compare two objects. What could be simpler? There are many ways to get it wrong. Writing a complex Comparator is tedious and error-prone. A single mistake can lead to the dreaded error. In this talk, we take a detailed look at Comparators and examine how to write a correct Comparator. We cover several common pitfalls. We also cover some utility methods introduced in Java 8 that make it easy to compose complex Comparators from simpler ones. These enable you to write correct, sophisticated Comparators much more quickly and easily. # Stuart Marks Stuart Marks is a Principal Member of Technical Staff in the Java Platform Group at Oracle. He is currently working on a variety of JDK core libraries projects, including Collections, Lambda, and Streams, as well as improving test quality and performance. As his alter ego "Dr Deprecator" he also works on the Java SE deprecation mechanism. He has previously worked on JavaFX and Java ME at Sun Microsystems. He has over twenty years of software platform product development experience in the areas of window systems, interactive graphics, and mobile and embedded systems. Stuart holds a Master's degree in Computer Science and a Bachelor's degree in Electrical Engineering from Stanford University.
More from this channel
-
32:13
Writing Groovy AST Transformations: Getting Practical in an hour! by Baruch Sadogursky
-
25:58
TweetWallFX - Behind the Scenes by Sven Reimers
-
29:44
Second generation "workflow managers" for big data by Alex Van Boxel
-
29:13
Secrets are secrets. Please maintain them as secrets by Alex Soto
-
2:13:40
JavaScript build pipelines with Gulp.js by Stefan Baumgartner
-
2:04:09
Powerful Metaprogramming Techniques With Groovy by Jeff Brown
-
2:38:32
Distributed Machine Learning 101 using Apache Spark from a Browser by Xavier Tordoir/Andy Petrella
-
2:36:21
Caching 101: Caching on the JVM (and beyond) by Alex Snaps/Louis Jacomet