Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #8959
| From | Daniel Pitts <newsgroup.nospam@virtualinfinity.net> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: constructing a constant HashMap |
| References | <ktbk975fhdiok67oitle60ihoqhlrt1ml1@4ax.com> <49CdnacDvODl-wfTnZ2dnUVZ_hmdnZ2d@earthlink.com> <j7dq4g$8tv$1@speranza.aioe.org> <4e9b910a$0$288$14726298@news.sunsite.dk> <j7il4v$ccd$3@speranza.aioe.org> |
| Message-ID | <5Phnq.3082$Oz5.1690@newsfe16.iad> (permalink) |
| Date | 2011-10-18 09:28 -0700 |
On 10/17/11 6:35 PM, B1ll Gat3s wrote:
> On 16/10/2011 10:20 PM, Arne Vajhøj wrote:
>> On 10/16/2011 1:29 AM, B1ll Gat3s wrote:
>>> This works in ANY setting where an expression of type Map<String,String>
>>> is appropriate:
>>>
>>> new HashMap<String,String> () {
>>> {
>>> put("aaa", "bbb");
>>> ...
>>> }}
>>
>> But it is way more difficult to read
>
> No it isn't.
>
That is opinion.
The syntax in question is a bit esoteric and would therefor have a
greater potential to confuse maintainers with less experience.
Also, if someone doesn't think hard about what that really is doing,
they may not fully understand the consequences of that approach.
The more I think about this "problem", the more I think that a
properties file may be more appropriate than an "in code" solution for
most cases.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
constructing a constant HashMap Roedy Green <see_website@mindprod.com.invalid> - 2011-10-15 18:14 -0700
Re: constructing a constant HashMap Arne Vajhøj <arne@vajhoej.dk> - 2011-10-15 21:36 -0400
Re: constructing a constant HashMap Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2011-10-16 16:51 +0200
Re: constructing a constant HashMap markspace <-@.> - 2011-10-15 18:59 -0700
Re: constructing a constant HashMap Roedy Green <see_website@mindprod.com.invalid> - 2011-10-15 19:25 -0700
Re: constructing a constant HashMap Roedy Green <see_website@mindprod.com.invalid> - 2011-10-15 19:19 -0700
Re: constructing a constant HashMap Patricia Shanahan <pats@acm.org> - 2011-10-16 06:07 +0100
Re: constructing a constant HashMap B1ll Gat3s <wm.g4t3s@m1cr0s0f7.c0m> - 2011-10-16 01:29 -0400
Re: constructing a constant HashMap Tom Anderson <twic@urchin.earth.li> - 2011-10-17 00:57 +0100
Re: constructing a constant HashMap Patricia Shanahan <pats@acm.org> - 2011-10-17 01:02 +0100
Re: constructing a constant HashMap Arne Vajhøj <arne@vajhoej.dk> - 2011-10-16 22:20 -0400
Re: constructing a constant HashMap B1ll Gat3s <wm.g4t3s@m1cr0s0f7.c0m> - 2011-10-17 21:35 -0400
Re: constructing a constant HashMap Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2011-10-18 09:28 -0700
Re: constructing a constant HashMap David Lamb <dalamb@cs.queensu.ca> - 2011-10-20 12:55 -0400
Re: constructing a constant HashMap Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-10-16 11:11 -0300
Re: constructing a constant HashMap Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2011-10-16 10:39 -0700
csiph-web