Data Structures in Java: Part 14, The Comparator Interface, Part 6

Baldwin shows you how to use a Comparator created by the reverseOrder method of the Collections class to sort a list into reverse natural order. He also shows you how to use the reverse method of the Collections class to reverse the order of the elements in a list.

provided by: 
Originally published at Internet.com


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

Preface

A miniseries

This is the fourteenth 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 13, The Comparator Interface, Part 5.

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 sixth 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.

Viewing tip

You may find it useful to open another copy of this lesson in a separate browser window. That will make it easier for you to scroll back and forth among the different listings while you are reading about them.

Supplementary material

I recommend that you also study the other lessons in my extensive collection of online Java tutorials. You will find those lessons published at Gamelan.com. However, as of the date of this writing, Gamelan doesn't maintain a consolidated index of my Java tutorial lessons, and sometimes they are difficult to locate there. You will find a consolidated index at Baldwin's Java Programming Tutorials.

Preview

In this lesson, I will teach you how to use a Comparator created by the reverseOrder method of the Collections class to sort a list into reverse natural order. I will also teach you how to use the reverse method of the Collections class to reverse the order of the elements in a list.

Discussion and Sample Program

Beginning with a quiz ...

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