Note: information on this page refers to Ceylon 1.1, not to the current release.
&
(intersection) operator
The left-associative, binary infix &
operator is used to compute the
intersection of its operands.
Usage
Intersection on values:
void m(Set<Integer> primes, Set<Integer> evens) {
Set<Integer> two = primes & evens;
}
Description
Note: The &
operator is also commonly used to
intersect types.
This page is about using the &
operator on values.
Definition
The &
operator is defined as follows:
lhs.intersection(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
whose element type is the intersection of the
element types of its operands.
See also
- API documentation for
Set
- set operators in the language specification
- operator precedence in the language specification
- Operator polymorphism