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

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


The following commit(s) were added to refs/heads/asf-site by this push:
     new e78b10b  add Guava example
e78b10b is described below

commit e78b10bf49e9495be6d84b4dc2ae76c668327a19
Author: Paul King <[email protected]>
AuthorDate: Wed Dec 3 15:46:01 2025 +1000

    add Guava example
---
 site/src/site/blog/fruity-eclipse-grouping.adoc | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/site/src/site/blog/fruity-eclipse-grouping.adoc 
b/site/src/site/blog/fruity-eclipse-grouping.adoc
index 87449c0..2eb1112 100644
--- a/site/src/site/blog/fruity-eclipse-grouping.adoc
+++ b/site/src/site/blog/fruity-eclipse-grouping.adoc
@@ -256,7 +256,7 @@ on multimaps as this example shows:
 var fruitColors = Multimaps.mutable.set.empty()
 fruitColors.putAll('red', ['🍒', '🍎'])
 fruitColors.putAll('green', ['🍎', '🍌', '🥑'])
-fruitColors.put('green', '🍌')
+fruitColors.put('yellow', '🍌')
 println fruitColors
 println fruitColors.flip()
 ----
@@ -268,6 +268,22 @@ Which has this output:
 {🍒=[red], 🍌=[green, yellow], 🥑=[green], 🍎=[red, green]}
 ----
 
+Speaking of fruit, we should consider this last example
+also using Guava (Google's collection library):
+
+[source,groovy]
+----
+def fruitColors = HashMultimap.create()
+fruitColors.putAll('red',    ['🍒', '🍎'])
+fruitColors.putAll('green',  ['🍎', '🍌', '🥑'])
+fruitColors.put('yellow', '🍌')
+println fruitColors
+
+def flipped = HashMultimap.create()
+Multimaps.invertFrom(fruitColors, flipped)
+println flipped
+----
+
 == Further information
 
 * Repo with example code: 
https://github.com/paulk-asert/fruity-eclipse-collections

Reply via email to