Community
Participate
Working Groups
Build Identifier: Please add a union function which creates a collection list out of two given collections Reproducible: Always
Why doesn't listA + listB work for you? If you want a union, you could even do a newLinkedHashSet(listA + listB). Please reopen if I missed your point.
Sorry, I meant (listA + listB).toSet
That works. But if you are somewhere in an expression it feels more natural (to me) to write a.b.c.union(x.y.z).doSomething than (a.b.c + x.y.z).doSomething Please close again if you don't agree
what about import static extension com.google.common.collect.Iterables.* newArrayList("A","B").concat(newArrayList("C", "D"))
I don't like the idea to have something like union on iterables or collections. Union (and intersection) are set operations and are indeed available on com.google.common.collect.Sets. I can imagine to have #concat as an alias to iterable+iterable and #union, #intersection and #difference available on instances of java.util.Set
Closing this since the standard lib supports (listA + listB).toSet and if that is not good enough in a certain context one can define an extension method for that context.
Closing all bugs that were set to RESOLVED before Neon.0