YoVDO

Comparison Method Violates Its General Contract! - Part 1

Offered By: Devoxx via YouTube

Tags

Devoxx Courses Java Courses Sorting Algorithms Courses

Course Description

Overview

Save Big on Coursera Plus. 7,000+ courses at $160 off. Limited Time Only!
Explore the intricacies of Comparators in Java and learn how to avoid the "Comparison Method Violates Its General Contract!" exception in this 30-minute Devoxx conference talk by Stuart Marks. Dive deep into the Comparator interface, understanding its purpose and common pitfalls in implementation. Discover techniques for writing correct Comparators, including the use of utility methods introduced in Java 8 for composing complex Comparators from simpler ones. Gain insights from examples such as wrapper comparators, relational comparators, and logging comparators. Learn to differentiate between Comparator and Comparable interfaces while mastering the art of creating sophisticated and error-free Comparators for efficient sorting in Java applications.

Syllabus

Introduction
Title
Integers
Comparator
Illegal argument exception
Demo
Run
Writing a comparator
The problem
Wrapper comparator
Relational comparator example
Logging comparator example
Checking the results
Recap
Comparator vs Comparable


Taught by

Devoxx

Related Courses

Algorithms, Part I
Princeton University via Coursera
Conception et mise en œuvre d'algorithmes.
École Polytechnique via Coursera
数据结构与算法 Data Structures and Algorithms
Peking University via Coursera
高级数据结构与算法
Peking University via Coursera
Principles of Computing (Part 2)
Rice University via Coursera