Loading topic
2 comes before 5. Objects are different. A Person has a name, age, and perhaps an employee ID. Which person comes first?2 min readequals and hashCode methods. You should also understand that a method can return a negative number, zero, or a positive number to represent a relationship.2 min readequals, and basic lambda syntax. This chapter focuses on the contract that makes a comparison reliable. A comparison contract is the set of rules that every Comparable or Comparator implementation should obey.2 min readCollections framework. You should also understand equals and hashCode. This chapter uses Java 7 syntax and APIs.2 min readequals and hashCode, lambda expressions, and method references. This chapter uses Java 8 or later.2 min readComparator, which is an object that compares two values and decides their order.2 min readList.sort were added in Java 8.2 min readComparable, Comparator, lists, arrays, streams, and lambda expressions. The focus is how each sorting API chooses an ordering and whether it changes the original data.2 min readequals and hashCode methods.2 min readComparable, Comparator, and the basic equals and hashCode methods. A sorted collection uses a comparison rule to decide where each element belongs. That rule can come from Comparable or from a Comparator.2 min readequals, hashCode, and the basic Comparable and Comparator APIs. The focus is how comparison interacts with equality, especially in sorted collections.2 min readequals and hashCode methods. The comparison rules matter because Java uses them not only to sort values, but also to place values inside sorted collections.2 min readequals and hashCode, lambda expressions, and method references. The goal is to choose the right place to define an ordering.2 min read