Give a link some love! Login and vote now.
By arikthered
via coderoshi.com
Published: Feb 14 2008 / 22:53
Don't you hate doing that if-null-then-populate-value-thing every time you want to generate a Map (usually of Collections)? Turn that 5-line sludge into 1-line elegance - and feel safe doing it! Believe me: this is cool.
Comments
b0b0b0b replied ago:
clone + reflection = blech
arikthered replied ago:
So you must also hate Spring, Guice, Eclipse and Maven - that's how they work, buddy.
b0b0b0b replied ago:
Actually yes I do.
johannz replied ago:
This is similar to existing code in Jakarta Commons Collections. Specifically, the LazyMap and the MultiValueMap classes. The only difference is his version is generic compatible.
Google Collections (http://code.google.com/p/google-collections/) offers a Generics-enabled multimap already.
Voters For This Link (12)
Voters Against This Link (4)