Re: [collections] Primitive-value maps
In a world of ininite coding time then I would be helping create maps in primitives, possibly based on those in the PCJ project (sourceforge). I don't think there is any doubt that maps need creating and [primitives] is the right project for that at Apache. If you want to help out in creating maps, I would be happy to help code review, discuss and make the commits. Stephen - Original Message - From: Rodney Waldhoff [EMAIL PROTECTED] No, classes for this purpose which previously existed in collections were moved to (and released from) the commons proper project primitives. http://jakarta.apache.org/commons/primitives On Thu, 4 Dec 2003, Arun Thomas wrote: Ash, Classes for this purpose which previously existed in COLLECTIONS were moved to the Sandbox project - PRIMITIVES. Please take a look there. There's apparently a lot of work going on with these classes, so check it out. -AMT -Original Message- From: Ash .. [mailto:[EMAIL PROTECTED] Sent: Thursday, December 04, 2003 9:51 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: [collections] Primitive-value maps While waiting for a +1 on the MapUtils.getPrimxxxValue() methods, I have been wondering why the commons collections framework does not have Maps that store and help retrieve primitive values. Stuff like IntMap with put(Object key, int value), etc. I mean, when there are primitive-value collections (lists and sets), why not map? Maybe this was discussed before. In any case, perhaps we can have them. Comments. Ash Reposting this, so that if we are decided on the method signatures, I can work on the implementation this weekend. Ash [Stephen] 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:[EMAIL PROTECTED] 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 .. [EMAIL PROTECTED] 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 _ Stay in touch with absent friends - get MSN Messenger http://www.msn.co.uk/messenger - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Tired of 56k? Get a FREE BT Broadband connection http://www.msn.co.uk/specials/btbroadband - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED
[collections] Primitive-value maps
While waiting for a +1 on the MapUtils.getPrimxxxValue() methods, I have been wondering why the commons collections framework does not have Maps that store and help retrieve primitive values. Stuff like IntMap with put(Object key, int value), etc. I mean, when there are primitive-value collections (lists and sets), why not map? Maybe this was discussed before. In any case, perhaps we can have them. Comments. Ash Reposting this, so that if we are decided on the method signatures, I can work on the implementation this weekend. Ash [Stephen] 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:[EMAIL PROTECTED] 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 .. [EMAIL PROTECTED] 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 _ Stay in touch with absent friends - get MSN Messenger http://www.msn.co.uk/messenger - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Tired of 56k? Get a FREE BT Broadband connection http://www.msn.co.uk/specials/btbroadband - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: FW: [collections] Primitive-value maps
Hi Arun, I had a look at Primitives, but I didnt find anything on primitive-value maps. Am I missing something here? Ashwin -Original Message- From: Arun Thomas [mailto:[EMAIL PROTECTED] Sent: Thursday, December 04, 2003 17:54 Ash, Classes for this purpose which previously existed in COLLECTIONS were moved to the Sandbox project - PRIMITIVES. Please take a look there. There's apparently a lot of work going on with these classes, so check it out. -AMT -Original Message- From: Ash .. [mailto:[EMAIL PROTECTED] Sent: Thursday, December 04, 2003 9:51 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: [collections] Primitive-value maps While waiting for a +1 on the MapUtils.getPrimxxxValue() methods, I have been wondering why the commons collections framework does not have Maps that store and help retrieve primitive values. Stuff like IntMap with put(Object key, int value), etc. I mean, when there are primitive-value collections (lists and sets), why not map? Maybe this was discussed before. In any case, perhaps we can have them. Comments. Ash _ Use MSN Messenger to send music and pics to your friends http://www.msn.co.uk/messenger - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FW: [collections] Primitive-value maps
I don't think any Map implementations have been created yet. Ash .. wrote: Hi Arun, I had a look at Primitives, but I didnt find anything on primitive-value maps. Am I missing something here? Ashwin -Original Message- From: Arun Thomas [mailto:[EMAIL PROTECTED] Sent: Thursday, December 04, 2003 17:54 Ash, Classes for this purpose which previously existed in COLLECTIONS were moved to the Sandbox project - PRIMITIVES. Please take a look there. There's apparently a lot of work going on with these classes, so check it out. -AMT -Original Message- From: Ash .. [mailto:[EMAIL PROTECTED] Sent: Thursday, December 04, 2003 9:51 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: [collections] Primitive-value maps While waiting for a +1 on the MapUtils.getPrimxxxValue() methods, I have been wondering why the commons collections framework does not have Maps that store and help retrieve primitive values. Stuff like IntMap with put(Object key, int value), etc. I mean, when there are primitive-value collections (lists and sets), why not map? Maybe this was discussed before. In any case, perhaps we can have them. Comments. Ash _ Use MSN Messenger to send music and pics to your friends http://www.msn.co.uk/messenger - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: FW: [collections] Primitive-value maps
Nope, You're not missing something here - there doesn't seem to be anything in that vein right now in primitives - seems like a potential area for improvement. However, you might want to label emails regarding primitives as [primitives] rather than [collections]. -AMT -Original Message- From: Ash .. [mailto:[EMAIL PROTECTED] Sent: Thursday, December 04, 2003 10:32 AM To: [EMAIL PROTECTED] Subject: RE: FW: [collections] Primitive-value maps Hi Arun, I had a look at Primitives, but I didnt find anything on primitive-value maps. Am I missing something here? Ashwin -Original Message- From: Arun Thomas [mailto:[EMAIL PROTECTED] Sent: Thursday, December 04, 2003 17:54 Ash, Classes for this purpose which previously existed in COLLECTIONS were moved to the Sandbox project - PRIMITIVES. Please take a look there. There's apparently a lot of work going on with these classes, so check it out. -AMT -Original Message- From: Ash .. [mailto:[EMAIL PROTECTED] Sent: Thursday, December 04, 2003 9:51 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: [collections] Primitive-value maps While waiting for a +1 on the MapUtils.getPrimxxxValue() methods, I have been wondering why the commons collections framework does not have Maps that store and help retrieve primitive values. Stuff like IntMap with put(Object key, int value), etc. I mean, when there are primitive-value collections (lists and sets), why not map? Maybe this was discussed before. In any case, perhaps we can have them. Comments. Ash _ Use MSN Messenger to send music and pics to your friends http://www.msn.co.uk/messenger - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [collections] Primitive-value maps
No, classes for this purpose which previously existed in collections were moved to (and released from) the commons proper project primitives. http://jakarta.apache.org/commons/primitives On Thu, 4 Dec 2003, Arun Thomas wrote: Ash, Classes for this purpose which previously existed in COLLECTIONS were moved to the Sandbox project - PRIMITIVES. Please take a look there. There's apparently a lot of work going on with these classes, so check it out. -AMT -Original Message- From: Ash .. [mailto:[EMAIL PROTECTED] Sent: Thursday, December 04, 2003 9:51 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: [collections] Primitive-value maps While waiting for a +1 on the MapUtils.getPrimxxxValue() methods, I have been wondering why the commons collections framework does not have Maps that store and help retrieve primitive values. Stuff like IntMap with put(Object key, int value), etc. I mean, when there are primitive-value collections (lists and sets), why not map? Maybe this was discussed before. In any case, perhaps we can have them. Comments. Ash Reposting this, so that if we are decided on the method signatures, I can work on the implementation this weekend. Ash [Stephen] 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:[EMAIL PROTECTED] 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 .. [EMAIL PROTECTED] 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 _ Stay in touch with absent friends - get MSN Messenger http://www.msn.co.uk/messenger - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Tired of 56k? Get a FREE BT Broadband connection http://www.msn.co.uk/specials/btbroadband - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- - Rod http://radio.weblogs.com/0122027/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]