TimurMahammadov / google-collections

Automatically exported from code.google.com/p/google-collections
Apache License 2.0
0 stars 0 forks source link

DollarMaps, easy-on-the-eye Map construction #57

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I recently wrote a utility for easy Map construction:
http://tinyurl.com/564386). I find this more convenient to use than your
ImmutableMapBuilder, Maps.immutableMap() or other utility methods. Mostly
because the DollarMaps map builder segments are all Iterable, but also
because I think it reads better for small maps and that all iterable map
builders have predictable ordering.

The only real issue I found is that you have to be careful when passing
null arguments in the first element.
So this works: $("blah",43).$(null,54);
this doesn't: $(null,43).$("hi",54);
fix: $((String)null,43).$("hi",54);

Personally I'm not a fan of putting null values in maps anyway, so I don't
mind the minor glitch. Anyway, it would be cool if you could include
DollarMaps in some form, that would save me another dependency ;-)

Cheers
Robbie

Original issue reported on code.google.com by robbie.v...@gmail.com on 8 Apr 2008 at 6:10

GoogleCodeExporter commented 9 years ago
Thanks for offering this contribution to the library! However, we'll pass on
including it.

The general structure is similar to our ImmutableMapBuilder class. While your
DollarMap requires less typing, which is nice, alphanumeric names are more in 
the
spirit of general Java practice.

Original comment by jared.l....@gmail.com on 8 Apr 2008 at 10:56