This is an automated email from the ASF dual-hosted git repository.

git-site-role pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/groovy-dev-site.git


The following commit(s) were added to refs/heads/asf-site by this push:
     new c3724f2  2025/12/08 06:12:16: Generated dev website from 
groovy-website@f7af81b
c3724f2 is described below

commit c3724f26b65984ae343d67f13b447a2c5514daf9
Author: jenkins <[email protected]>
AuthorDate: Mon Dec 8 06:12:16 2025 +0000

    2025/12/08 06:12:16: Generated dev website from groovy-website@f7af81b
---
 blog/fruity-eclipse-grouping.html | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/blog/fruity-eclipse-grouping.html 
b/blog/fruity-eclipse-grouping.html
index 48911d5..0d6d4cd 100644
--- a/blog/fruity-eclipse-grouping.html
+++ b/blog/fruity-eclipse-grouping.html
@@ -391,19 +391,19 @@ println fruitColors.flip()</code></pre>
 </div>
 <div class="paragraph">
 <p>Speaking of fruit, we should consider this last example
-also using Guava (Google&#8217;s collection library):</p>
+also using Guava (Google&#8217;s collection library). For
+Guava, the <code>ImmutableMultimap</code> class has an <code>inverse</code> 
method:</p>
 </div>
 <div class="listingblock">
 <div class="content">
-<pre class="prettyprint highlight"><code data-lang="groovy">def fruitColors = 
HashMultimap.create()
-fruitColors.putAll('red',    ['🍒', '🍎'])
-fruitColors.putAll('green',  ['🍎', '🍌', '🥑'])
-fruitColors.put('yellow', '🍌')
-println fruitColors
+<pre class="prettyprint highlight"><code data-lang="groovy">def fruitColors = 
new ImmutableMultimap.Builder&lt;String, String&gt;()
+    .putAll("red", ["🍒", "🍎"])
+    .putAll("green", ["🍎", "🍌", "🥑"])
+    .put("yellow", "🍌")
+    .build()
 
-def flipped = HashMultimap.create()
-Multimaps.invertFrom(fruitColors, flipped)
-println flipped</code></pre>
+println fruitColors
+println fruitColors.inverse()</code></pre>
 </div>
 </div>
 <div class="paragraph">
@@ -415,6 +415,11 @@ println flipped</code></pre>
 {🥑=[green], 🍎=[red, green], 🍌=[yellow, green], 🍒=[red]}</pre>
 </div>
 </div>
+<div class="paragraph">
+<p>The <code>inverse</code> method is available on 
<code>ImmutableListMultimap</code> and <code>ImmutableSetMultimap</code> 
instances;
+for other cases, there is an <code>invertFrom</code> utility method
+in the <code>Multimaps</code> class.</p>
+</div>
 </div>
 </div>
 <div class="sect1">

Reply via email to