sorting by a alphabetical order with two string properties
Hi,
I'm new to this sorting stuff. Figured out the point of the Comparator interface. Now I'm wondering how to implement the simple logic of figuring out which string comes lower in the alphabet.
For example, two strings are cat and dog, cat comes first but how do I test for that in java? thanks
[318 byte] By [
krebsneta] at [2007-10-2 2:02:27]

[snip]
> For example, two strings are cat and dog, cat comes
> first but how do I test for that in java? thanks
You ask the String class to do this test, and after looking at the JavaDoc for that class you see the various "compareTo" methods provided and you call one of those.
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html
Good Luck
Lee
tsitha at 2007-7-15 19:43:49 >
