Re: [lang] null-safe compareTo method

2006-02-21 Thread Geoffrey De Smet
Thanks, but: equals doesn't compare: it only returns true or false, not -1, 0 and 1. I use it in a custom Comporator to sort a List with Collections.sort(), The CompareToBuilder is a bit overkill: I just need to compare 2 strings, null safe. Not that it's hard or a lot to write :) just wanted

RE: [lang] null-safe compareTo method available in collections

2006-02-20 Thread Eric Jablow
-Original Message- From: news [mailto:[EMAIL PROTECTED] On Behalf Of Geoffrey De Smet Sent: Monday, February 20, 2006 6:05 AM Is there a null-safe compare method? I need to compare 2 strings: - both null = equal - one null = that one is smaller - neither null = a.compareTo(b) Else

RE: [lang] null-safe compareTo method

2006-02-20 Thread Alfredo Ledezma Melendez
Specifically for strings use this: http://jakarta.apache.org/commons/lang/api/org/apache/commons/lang/StringUtils.h tml#equals(java.lang.String,%20java.lang.String) For more generic handling of comparison checking: