commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niall Pemberton" <niall.pember...@blueyonder.co.uk>
Subject Re: [BeanUtils] case insensitive BeanComparator?
Date Wed, 07 Sep 2005 19:30:56 GMT
You could create an org.apache.commons.collections.Transformer ....

public class LowerCaseTransformer implements Transformer {
     public Object transform(Object input) {
          return ((String)input).toLowerCase();
     }
}

Comparator comparator = new TransformingComparator(new
LowerCaseTransformer());
Collections.sort(foobies, new BeanComparator("billingAddress.lastName",
comparator));

Niall

----- Original Message ----- 
From: "Bernard, Shawn" <Shawn.Bernard@turner.com>
Sent: Wednesday, September 07, 2005 7:15 PM


I'm using a BeanComparator in a Collections.sort():

   Collections.sort(foobies, new BeanComparator("billingAddress.lastName"));

I was wondering if there was a way to make the sort case insensitive
(without creating my own custom comparator).

Thanks,

Shawn



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message