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

~ (complement) operator

The left-associative, binary infix ~ operator is used to compute the complement of its left-hand operand in its right-hand operand.

Usage

void m<Dog>(Set<Dog> dogs, Set<Dog> blackDogs) 
  given Dog satisfies Object {
    Set<Dog> nonBlackDogs = dogs ~ blackDogs;
}

Description

Another way of describing this operator is 'set minus'.

Definition

The ~ operator is defined as follows:

lhs.complement(rhs);

See the language specification for more details.

Polymorphism

The ~ operator is polymorphic. The meaning of ~ depends on the Set interface.

Type

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

See also