Skip to main content

Set<E>

Implements the Iterable<E> trait.

A set is an unordered collection of values of type E which cannot contain duplicates.

A set can be created from a list using the toSet() method:

[1, 2, 2, 3].toSet()
// -> [1, 2, 3]

The following operations are supported for sets:

+ : (Set<E>, Iterable<E>) -> Set<E>

Given a set and an iterable, returns a new set containing the elements of both collections.

- : (Set<E>, Iterable<E>) -> Set<E>

Given a set and an iterable, returns a shallow copy of the set minus the elements of the iterable.

in, !in : (E, Set<E>) -> Boolean

Given a value and a set, returns true if the set contains the value (or not).

The following methods are available for a set:

intersect( right: Iterable<E> ) -> Set<E>

Returns the intersection of the set and the given iterable.

note

Sets in Nextflow are backed by the Java and Groovy standard libraries, which may expose additional methods. Only methods which are recommended for use in Nextflow are documented here.

On this Page