O'Reilly logo

Learning Jakarta Struts 1.2: a concise and practical tutorial by Stephan Wiesner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

7.5 Sorting Tags

By implementing Comparable, you allow your class to interoperate with all of the many generic algorithms and collection implementations that depend on this interface. You gain a tremendous amount of power for a small amount of effort. Virtually all of the value classes in the Java platform libraries implement Comparable

Joshua Bloch: Effective Java, Item 11

Let’s assume that we have to implement a book catalog, containing a set of books (for example, the result of a search). Suppose we want to sort these books without burdening the database again. If we wish to sort only on one category (for example, sort by title), then this is quite easy to accomplish, but if we need to sort by title and price, it becomes complicated.

We’ll ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required