> > I think we probably still want to think about the semantics of element
> > cardinality a bit--e.g., currently if list A has 1 copies of 
> > "foo", and list
> > B has 3 copies of "foo", ListUtils.itersection(A,B) will 
> > contain 3 copies,
> > which doesn't seem quite right to me. 

> Well, I guess it's a little hard to decide what is the "right" thing
> when we talking about perform set operation on non-sets.

Actually, I think the semantics are rather clear, even for bag-like
collections:

If C = intersection(A,B), then the cardinality of each element e in C should
be min(cardnality of e in A, cardinality of e in B).  This does give you the
commutativity you're looking for.  It's just a tricky to implement
efficiently since Collection doesn't have a built-in cardinality operation.

Reply via email to