Return-Path: Delivered-To: apmail-directory-dev-archive@www.apache.org Received: (qmail 29399 invoked from network); 2 Apr 2009 08:14:40 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 2 Apr 2009 08:14:40 -0000 Received: (qmail 51574 invoked by uid 500); 2 Apr 2009 08:14:40 -0000 Delivered-To: apmail-directory-dev-archive@directory.apache.org Received: (qmail 51499 invoked by uid 500); 2 Apr 2009 08:14:40 -0000 Mailing-List: contact dev-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Apache Directory Developers List" Delivered-To: mailing list dev@directory.apache.org Received: (qmail 51491 invoked by uid 99); 2 Apr 2009 08:14:40 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Apr 2009 08:14:40 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of ayyagarikiran@gmail.com designates 209.85.198.230 as permitted sender) Received: from [209.85.198.230] (HELO rv-out-0506.google.com) (209.85.198.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Apr 2009 08:14:30 +0000 Received: by rv-out-0506.google.com with SMTP id l9so460467rvb.25 for ; Thu, 02 Apr 2009 01:14:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=sgRP1VCGveZ4xK5tdEre1VJWAZdfBXq0gEUDL1a57a8=; b=fZWfq0TNYDCkLZJId6TRlV36QA4UCHRMTnycGpOAtsuIQO0AHCG9sa9QaEPTn2m6Fq lg7RppJn0YDEk3Fy1pOloVPeh9jQDD7kanNBSIapIdCi7MyIVIDdWf+CLFXyewE4LVjF XyYCqXlb3lO0dOO5xsaRw3RMTeyuhj3s/zuNE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; b=KDSSRA3MsNnvP87PiIewbR0jia3Bpp8djVGNoeZCRSe+SjJWXur3W/aGggSfy527Uz CqBajAkDJAT3fz4Vgko7i3dnkhjW9nq73ni37z6azSu/TFaLvNT3XLW9IhpI5j2QS/KU dvzamIrNrKgBrxz0bc6byWqeTT08aRXFDMHP8= Received: by 10.141.13.13 with SMTP id q13mr4442246rvi.163.1238660049274; Thu, 02 Apr 2009 01:14:09 -0700 (PDT) Received: from ?192.168.2.90? ([61.246.236.149]) by mx.google.com with ESMTPS id f42sm2401548rvb.31.2009.04.02.01.14.07 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 02 Apr 2009 01:14:08 -0700 (PDT) Message-ID: <49D473C7.3070203@gmail.com> Date: Thu, 02 Apr 2009 13:43:59 +0530 From: ayyagarikiran User-Agent: Thunderbird 2.0.0.21 (X11/20090318) MIME-Version: 1.0 To: Apache Directory Developers List Subject: Re: [ApacheDS][AvlTreeMap] insert() fails to replace old value References: <49D3B724.1050004@gmail.com> <27096663-8C70-4C4F-8461-5795F1757F9A@yahoo.com> <49D44D06.2060104@gmail.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org David Jencks wrote: > > On Apr 1, 2009, at 10:28 PM, Kiran Ayyagari wrote: > >> This can easily lead to CCE without some extra checks. > > I don't quite see your point of view. I figured that "put" methods only > return a value when they replace a previous value. If duplicates are > allowed, then put will never replace a value and always return null. If > duplicates are not allowed, then there will be 0 (null) or 1 (V) objects > to return. > ah, right, I was mixing both the value passed and the actual 'value' present in node. > I don't see how a return from this can be useful unless something like > remove(K, null) removes all the values associated with K. In that case > returning AvlTree might be more appropriate. On the other hand my > naive expectations would be that remove(K, null) would only remove > something is insert(K, null) had been called. If I wanted to remove all > the values associated with a K I'd want a method remove(K) and having > this return an AvlTree(V) seems more appropriate (this could be a > singleton if there is only one value). the current impl removes the all the values associated with a key if remove(K,null) is called assuming that we don't allow null to be inserted by checking at a higher level (ex. the XXXTable implementations) But, yes this is certainly possible to have null values, provided the comparators handle them properly. Returning a singleton AvlTree would be a overhead, but if this is something really required will add it thanks David. Kiran Ayyagari