Data Structures in Java: Part 12, The Comparator Interface, Part 4

Baldwin shows you how to extract the contents of a collection into an array, and how to use a Comparator object to sort the contents of the array into reverse natural order. He also shows you how to sort the contents of the array into natural order without the use of a Comparator object.

provided by: 
Originally published at Internet.com


Java Programming, Lecture Notes #1372 * Preface * Preview * Discussion and Sample Program * Summary * What's Next -----------------------------------

Preface

A miniseries

This is the twelfth lesson in a miniseries on Java data structures and the Java Collections Framework. The first lesson in the miniseries was entitled Data Structures in Java: Part 1, Getting Started. The previous lesson was entitled Data Structures in Java: Part 11, The Comparator Interface, Part 3.

The purpose of this miniseries is to help you learn the essential features of Object-Oriented data structures in Java using the Collections Framework.

A sub-series

This is also the third lesson in a sub-series on the Comparator interface. The primary purpose of the lessons in this sub-series is to teach you about the interactions between the Comparator interface and the Collections Framework.

However, this lesson departs somewhat from that primary purpose and teaches you how to use a Comparator object to sort the contents of an array containing references to objects. Technically speaking, an array is not part of the core Collections Framework. However, it is definitely a first cousin to the Framework...

Read article at Internet.com site
Regional Articles
- Data Structures in Java: Part 12, The Comparator Interface, Part 4 Alabama
- Data Structures in Java: Part 12, The Comparator Interface, Part 4 Alaska
- Data Structures in Java: Part 12, The Comparator Interface, Part 4 Arizona
- Data Structures in Java: Part 12, The Comparator Interface, Part 4 Arkansas
- Data Structures in Java: Part 12, The Comparator Interface, Part 4 California
- Data Structures in Java: Part 12, The Comparator Interface, Part 4 Colorado
- Data Structures in Java: Part 12, The Comparator Interface, Part 4 Connecticut
- Data Structures in Java: Part 12, The Comparator Interface, Part 4 DC
- Data Structures in Java: Part 12, The Comparator Interface, Part 4 Delaware
- Data Structures in Java: Part 12, The Comparator Interface, Part 4 Florida
- Data Structures in Java: Part 12, The Comparator Interface, Part 4 Georgia
- Data Structures in Java: Part 12, The Comparator Interface, Part 4 Hawaii
- Data Structures in Java: Part 12, The Comparator Interface, Part 4 Idaho
- Data Structures in Java: Part 12, The Comparator Interface, Part 4 Illinois
- Data Structures in Java: Part 12, The Comparator Interface, Part 4 Indiana
- Data Structures in Java: Part 12, The Comparator Interface, Part 4 Iowa
- Data Structures in Java: Part 12, The Comparator Interface, Part 4 Kansas
- Data Structures in Java: Part 12, The Comparator Interface, Part 4 Kentucky
- Data Structures in Java: Part 12, The Comparator Interface, Part 4 Louisiana
- Data Structures in Java: Part 12, The Comparator Interface, Part 4 Maine
- Data Structures in Java: Part 12, The Comparator Interface, Part 4 Maryland
- Data Structures in Java: Part 12, The Comparator Interface, Part 4 Massachusetts
- Data Structures in Java: Part 12, The Comparator Interface, Part 4 Michigan
- Data Structures in Java: Part 12, The Comparator Interface, Part 4 Minnesota
- Data Structures in Java: Part 12, The Comparator Interface, Part 4 Mississippi
- Data Structures in Java: Part 12, The Comparator Interface, Part 4 Missouri
- Data Structures in Java: Part 12, The Comparator Interface, Part 4 Montana
- Data Structures in Java: Part 12, The Comparator Interface, Part 4 Nebraska
- Data Structures in Java: Part 12, The Comparator Interface, Part 4 Nevada
- Data Structures in Java: Part 12, The Comparator Interface, Part 4 New Hampshire
- Data Structures in Java: Part 12, The Comparator Interface, Part 4 New Jersey
- Data Structures in Java: Part 12, The Comparator Interface, Part 4 New Mexico
- Data Structures in Java: Part 12, The Comparator Interface, Part 4 New York
- Data Structures in Java: Part 12, The Comparator Interface, Part 4 North Carolina
- Data Structures in Java: Part 12, The Comparator Interface, Part 4 North Dakota
- Data Structures in Java: Part 12, The Comparator Interface, Part 4 Ohio
- Data Structures in Java: Part 12, The Comparator Interface, Part 4 Oklahoma
- Data Structures in Java: Part 12, The Comparator Interface, Part 4 Oregon
- Data Structures in Java: Part 12, The Comparator Interface, Part 4 Pennsylvania
- Data Structures in Java: Part 12, The Comparator Interface, Part 4 Rhode Island
- Data Structures in Java: Part 12, The Comparator Interface, Part 4 South Carolina
- Data Structures in Java: Part 12, The Comparator Interface, Part 4 South Dakota
- Data Structures in Java: Part 12, The Comparator Interface, Part 4 Tennessee
- Data Structures in Java: Part 12, The Comparator Interface, Part 4 Texas
- Data Structures in Java: Part 12, The Comparator Interface, Part 4 Utah
- Data Structures in Java: Part 12, The Comparator Interface, Part 4 Vermont
- Data Structures in Java: Part 12, The Comparator Interface, Part 4 Virginia
- Data Structures in Java: Part 12, The Comparator Interface, Part 4 Washington
- Data Structures in Java: Part 12, The Comparator Interface, Part 4 West Virginia
- Data Structures in Java: Part 12, The Comparator Interface, Part 4 Wisconsin
- Data Structures in Java: Part 12, The Comparator Interface, Part 4 Wyoming

Rss   Delicious   Digg   Add To My Yahoo   Add To My Google   Bookmark   Search Plugin

Topics:
Architecture & Design Languages & Tools Project Management Web Services
Database Microsoft & .NET Security Wireless
Java Open Source Techniques XML