Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!news-out.readnews.com!news-xxxfer.readnews.com!nx02.iad01.newshosting.com!newshosting.com!69.16.185.21.MISMATCH!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: bob smith Newsgroups: comp.lang.java.programmer Subject: verbose sort Date: Thu, 2 Aug 2012 08:37:07 -0700 (PDT) Organization: http://groups.google.com Lines: 23 Message-ID: NNTP-Posting-Host: 184.76.139.203 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1343922669 2598 127.0.0.1 (2 Aug 2012 15:51:09 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 2 Aug 2012 15:51:09 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=184.76.139.203; posting-account=v1lx5wkAAAALWYfGBkwkMb2guPF9cW2u User-Agent: G2/1.0 X-Received-Bytes: 1461 Xref: csiph.com comp.lang.java.programmer:16962 I have some code that sorts a list like so: Vector my_list = new Vector(); Comparator c = new Comparator() { @Override public int compare(String object1, String object2) { if (object1 == null) return -1; if (object2 == null) return 1; object1 = object1.toLowerCase(); object2 = object2.toLowerCase(); return object1.compareTo(object2); }; }; Collections.sort(my_list, c); This seems like a lot of code for such a common operation. Is there a more succinct way of doing this?