Guava has some tools that make map literals a little prettier:<p><pre><code>  Map&lt;Foo, Bar&gt; map = ImmutableMap.of(foo1, bar1, foo2, bar2, foo3, bar3, foo4, bar4);
</code></pre>
There are overloads for up to 5 entries, and they&#x27;re even key&#x2F;value typesafe.