can I define the comarator? for example, how can I define first>second or first<second? String.CASE_INSENSITIVE_ORDER.compare(first, second)
Thanks!!!
Keith Lynn
Ranch Hand
Joined: Feb 07, 2005
Posts: 2341
posted
0
Yes, you can create a class definition which implements the Comparator interface.
Jeff Albertson
Ranch Hand
Joined: Sep 16, 2005
Posts: 1780
posted
0
Here is the source code for CASE_INSENSITIVE_ORDER, as an example:
Does anyone know why it uses both toUpperCase and toLowerCase?
There is no emoticon for what I am feeling!
Yuriy Zilbergleyt
Ranch Hand
Joined: Dec 13, 2004
Posts: 429
posted
0
Originally posted by Jeff Albertson:
Does anyone know why it uses both toUpperCase and toLowerCase?
Yeah, that does look mighty strange. I can't think of a case when (Character.toUpperCase(c1) != Character.toUpperCase(c2) && Character.toLowerCase(c1) == Character.toLowerCase(c2)) evaluates to true. Are they just being overparanoid?