Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 89745 invoked from network); 12 Apr 2004 07:31:14 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 12 Apr 2004 07:31:14 -0000 Received: (qmail 9422 invoked by uid 500); 12 Apr 2004 07:30:46 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 9275 invoked by uid 500); 12 Apr 2004 07:30:45 -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 9259 invoked from network); 12 Apr 2004 07:30:44 -0000 Received: from unknown (HELO scaup.mail.pas.earthlink.net) (207.217.120.49) by daedalus.apache.org with SMTP; 12 Apr 2004 07:30:44 -0000 Received: from h-66-167-162-220.sndacagl.dynamic.covad.net ([66.167.162.220] helo=terrordome.serveftp.org) by scaup.mail.pas.earthlink.net with esmtp (Exim 3.33 #1) id 1BCvuD-000585-00 for commons-dev@jakarta.apache.org; Mon, 12 Apr 2004 00:30:57 -0700 Received: from apache.org (localhost [127.0.0.1]) by terrordome.serveftp.org (Postfix) with ESMTP id F3A4124C4FB for ; Mon, 12 Apr 2004 00:35:36 -0700 (PDT) Message-ID: <407A46C8.4020705@apache.org> Date: Mon, 12 Apr 2004 00:35:36 -0700 From: "matthew.hawthorne" User-Agent: Mozilla Thunderbird 0.5 (X11/20040208) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jakarta Commons Developers List Subject: Re: [collections] MultiKeyMap References: <000601c41fa5$1d339080$0f3b8051@oemcomputer> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Michael Heuer wrote: > Might you also be able to use an unmutable MultiKey for storage in the > hashed map and a mutable MultiKey for lookups, with matching equals and > hashCode implementations? > > void put(Obj a, Obj b, ...) { > map.put(new MultiKey(a, b, ..)); > } > > private MutableMultiKey lookupKey = new MutableMultiKey(); > > Object get(Obj a, Obj b, ...) { > lookupKey.setKeys(a, b, ..)); > return map.get(lookupKey); > } > > I have something that works this way lying around somewhere. I'm not 100% sure, but I don't think this is thread safe, since multiple threads may be calling the get method at the same time and thus modifying the lookupKey instance var. --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org