Am 10.06.2015 01:17, schrieb Keegan Witt:
Although, to list a counter-example, Guava's implementation only works
with sets.

@Grab(group='com.google.guava', module='guava', version='18.0')
import com.google.common.collect.Sets

def a = [1,1] as Set
def b = [1,2,3] as Set
assert Sets.intersection(a, b) == [1] as Set

That seemed like a more natural choice to me, though I doubt we'd move
in that direction now.  There are some weird things about having it at
the Collection level.  For example, this fails despite technically being
a Collection

import java.beans.beancontext.*

BeanContextChildSupport bean1 = new BeanContextChildSupport()
BeanContextChildSupport bean2 = new BeanContextChildSupport()
BeanContextSupport context1 = new BeanContextSupport()
context1.add(bean1)
context1.add(bean1)
BeanContextSupport context2 = new BeanContextSupport()
context1.add(bean1)
context1.add(bean2)

that's context 2 I guess...

assert context1.intersect(context2) == 1

and here == [bean1]

anyway... will still not work, because one context will be empty, so the intersection will be as well. Why that is... frankly no idea, I never worked with that class before... but it makes me think I really don't like much of the bean stuff in the JDK ;)

bye blackdrag

--
Jochen "blackdrag" Theodorou
blog: http://blackdragsview.blogspot.com/

Reply via email to