Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 51626 invoked from network); 28 Feb 2005 20:47:00 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 28 Feb 2005 20:47:00 -0000 Received: (qmail 13000 invoked by uid 500); 28 Feb 2005 20:47:00 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 12509 invoked by uid 500); 28 Feb 2005 20:46:58 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 44524 invoked by uid 99); 28 Feb 2005 19:48:42 -0000 X-ASF-Spam-Status: No, hits=4.4 required=10.0 tests=DNS_FROM_RFC_POST,FORGED_MUA_OUTLOOK,MSGID_FROM_MTA_HEADER,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: domain of sualeh@hotmail.com designates 65.54.174.85 as permitted sender) Message-ID: X-Originating-IP: [65.54.174.200] X-Originating-Email: [sualeh@hotmail.com] X-Sender: sualeh@hotmail.com From: "Sualeh Fatehi" To: Subject: commons lang: Comparisons with null support Date: Mon, 28 Feb 2005 14:46:53 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1437 Disposition-Notification-To: "Sualeh Fatehi" X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 X-OriginalArrivalTime: 28 Feb 2005 19:48:08.0853 (UTC) FILETIME=[6D8FB450:01C51DCE] X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N I have not done an extensive search of the mailing list archives, but I was wondering if something like the following comparison functions with support for null values may be useful in commons lang StringUtils (and also DateUtils and NumberUtils): public static int compare(String left, String right) { if (left == right) { return 0; } if (left == null) { return -1; } if (right == null) { return 1; } return left.compareTo(right); } Sualeh. --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org