Tag

Comparable

1 views collected around this technical thread.

Rare Earth Juejin Tech Community
Rare Earth Juejin Tech Community
Dec 28, 2023 · Fundamentals

Understanding Comparison Methods in Java

This article explains various comparison methods in Java, including equality operators, the equals() method, Comparator and Comparable interfaces, and provides code examples for primitive, object, string comparisons, as well as custom sorting logic, highlighting their roles in sorting, searching, and data handling.

ComparableComparatorJava
0 likes · 14 min read
Understanding Comparison Methods in Java
Laravel Tech Community
Laravel Tech Community
Dec 12, 2022 · Fundamentals

Go 1.20 Release Candidate Highlights: New Slice‑to‑Array Conversion, Unsafe Package Functions, and Comparable Types

Go 1.20 RC1 introduces experimental RISC‑V/FreeBSD support, expands slice‑to‑array conversion, adds three new unsafe package functions, updates comparable type constraints, and changes struct value comparison order, while being the final version compatible with macOS 10.13/10.14, with download details provided.

ComparableGoGo1.20
0 likes · 4 min read
Go 1.20 Release Candidate Highlights: New Slice‑to‑Array Conversion, Unsafe Package Functions, and Comparable Types
Top Architect
Top Architect
Feb 12, 2021 · Fundamentals

Understanding Java's Comparable Interface and How to Implement It

This article explains the purpose of Java's Comparable interface, demonstrates sorting with built‑in classes like String, shows the failure when custom objects lack the interface, and provides a complete example of implementing Comparable to sort objects by a chosen field.

CollectionsComparableJava
0 likes · 8 min read
Understanding Java's Comparable Interface and How to Implement It
Selected Java Interview Questions
Selected Java Interview Questions
Nov 19, 2019 · Fundamentals

Understanding Java Comparable and Comparator: Concepts, Differences, and Code Examples

This article explains Java's two comparison mechanisms—Comparable and Comparator—detailing their purposes, implementation differences, and providing clear code examples that demonstrate how each works and when to use them in sorting custom objects.

Code ExampleComparableComparator
0 likes · 6 min read
Understanding Java Comparable and Comparator: Concepts, Differences, and Code Examples