Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Groovy - Guava classical set operations
@Grab(group='', module='guava', version='18.0')
import static*
def first = ['a', 'b', 'c'] as Set
def second = ['b', 'c', 'd', 'e'] as Set
println "In first not in second: ${difference(first, second)}"
println "In second not in first: ${difference(second, first)}"
println "Common: ${intersection(first, second)}"
println "All: ${union(first, second)}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.