From commons-dev-return-41510-apmail-jakarta-commons-dev-archive=jakarta.apache.org@jakarta.apache.org Mon Dec 01 23:09:07 2003 Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 220 invoked from network); 1 Dec 2003 23:09:07 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 1 Dec 2003 23:09:07 -0000 Received: (qmail 53758 invoked by uid 500); 1 Dec 2003 23:08:51 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 53581 invoked by uid 500); 1 Dec 2003 23:08:50 -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 53568 invoked from network); 1 Dec 2003 23:08:49 -0000 Received: from unknown (HELO hotmail.com) (64.4.47.21) by daedalus.apache.org with SMTP; 1 Dec 2003 23:08:49 -0000 Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Mon, 1 Dec 2003 15:08:53 -0800 Received: from 212.217.21.95 by by9fd.bay9.hotmail.msn.com with HTTP; Mon, 01 Dec 2003 23:08:53 GMT X-Originating-IP: [212.217.21.95] X-Originating-Email: [equinus100@hotmail.com] X-Sender: equinus100@hotmail.com From: "Ash .." To: commons-dev@jakarta.apache.org Cc: equinus100@hotmail.com Bcc: Subject: RE: FW: [collections] MapUtils.getXxx() return types Date: Mon, 01 Dec 2003 23:08:53 +0000 Mime-Version: 1.0 Content-Type: text/plain; format=flowed Message-ID: X-OriginalArrivalTime: 01 Dec 2003 23:08:53.0746 (UTC) FILETIME=[16EC4520:01C3B860] 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 >I would only add the >full signature version (with default). That way the method name can just be >getDouble(). But that would provoke the question "if I want to retrieve a primitive without specifying a default, why should I have to mention a default (even 0) everytime??" I would propose we inlclude both variants (with and sans default), and have a uniform naming for them. Even if we add only the default-taking method today, what if we decide tomorrow that the defaultless one can be useful. And then, I think it is ok if we cannot preserve the same method names. so, I propose the following: public static double getIntValue(Map map, Object key) public static double getIntValue(Map map, Object key, int defaultValue) etc for each prim (and String) Waiting for feedback from others. I can implement these methods after I am done with the subarray(prim[]) ones. >This is a very old class in [collections] and pre-dates me. I would >probably >oppose adding these methods now. But why?? Ash > >-----Original Message----- >From: Stephen Colebourne [mailto:scolebourne@btopenworld.com] > > >This is a very old class in [collections] and pre-dates me. I would >probably >oppose adding these methods now. However, now that we have them, I would >support having the primitive methods as you propose. I would only add the >full signature version (with default). That way the method name can just be >getDouble(). >Stephen > >----- Original Message ----- >From: "Ash .." > > I am curious to know why MapUtils does not have getters that return > > primitive types. Perhaps there was a discussion on whether it was needed >or > > not, you could point me to such discussion that took place in the past >when > > this class was conceived. > > In any case, I think that getters that return primitives could be very > > useful, much more than those that return wrapper objects. Thus, I think >we > > could do with methods like: > > > > MapUtils.getDoubleValue(Map map, Object key [,defaultValue]); > > > > If the answer to my question is "you can do a MapUtils.getDouble(map, > > key).doubleValue() and so on", > > I would say, having a built-in method enhances the use of this class >than > > having a programmer resort to such multiple method call. Of course, the > > internal implementation would do the same, but in the end, client code >would > > look far neater. > > > > Let me know, > > Ash > > _________________________________________________________________ Find a cheaper internet access deal - choose one to suit you. http://www.msn.co.uk/internetaccess --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org