Note: information on this page refers to Ceylon 1.1, not to the current release.

|= (union assign) operator

The right-associative, binary infix |= operator is used to compute the union of two operands, assigning the result to the left-hand operand.


void m(Set<Integer> odds, Set<Integer> evens) {
    variable Set<Integer> all = odds;
    all |= evens;



The |= operator is defined as follows:

lhs = lhs | rhs

See the language specification for more details.


The |= operator is polymorphic. Tge | in its definition is the union operator which depends on the Set interface.


The result type of the & operator is a Set with the same element type as the left hand operand's element type.

See also