Return-Path: Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 50821 invoked from network); 12 May 2003 13:50:22 -0000 Received: from baxter.tritus.ca (HELO secure.tritus.ca) (209.47.166.15) by daedalus.apache.org with SMTP; 12 May 2003 13:50:22 -0000 Received: from [10.200.200.129] (CPE00045ae165bc-CM014320108734.cpe.net.cable.rogers.com [::ffff:24.157.7.10]) (AUTH: CRAM-MD5 adam@tritus.ca, TLS: TLSv1/SSLv3,168bits,DES-CBC3-SHA) by secure.tritus.ca with esmtp; Mon, 12 May 2003 09:50:18 -0400 Date: Mon, 12 May 2003 09:45:40 -0400 From: Adam Sherman To: Dmitry Sklyut cc: Jakarta Commons Users List Subject: RE: Removing duplicates from a Collection Message-ID: <56510000.1052747140@saturn> In-Reply-To: References: X-Mailer: Mulberry/3.0.3 (Linux/x86) X-OpenPGP: 82C7 7288 650F 8F77 2FFB C170 3698 125A 79C3 FC80 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N On 05/12/03 06:36:16 -0700 Dmitry Sklyut wrote: > why don't you do: > > List l; > Set s; > > s.addAll(l); > > That should do the trick. Heh. That looks too simple. Actually, my needs are slightly complicated in how I define "duplicate" is wierd. The items have three properties but only one of them is important and defines uniqueness of the item. So I suppose that I could implement Object.equals() on the item and get the desired result, yes? Also, this is a collection with upwards of 50K items in it. Will this be performant? Thanks very much for your suggestions, A. -- Adam Sherman Tritus CG Inc. http://www.tritus.ca/ +1 (613) 797-6819