MPS 2020.1 Help

Set

A basic set container backed by either hash set or linked hash set.

Set type

set<Type>

Subtypes

Supertypes

Comparable types

sorted_set<Type>

sequence<Type>

java.util.Set<Type>

Set creation

new hashset
new linked_hashset

Parameter type

Result type

Type...
sequence<? extends Type>

set<Type>

Creates an empty set. Optionally, initial values may be specified right in the new set creation expression.

set<string> test = new hashset<string> {"A", "B", "C"};


Alternatively, a sequence may be specified that is used to copy elements from.

set<Type> = new hashset<Type> (sequence);

Operations on set

iterator

Operand type

Parameter type

Result type

sequence<Type>

none

modifying_iterator<Type>

This operation is redefined for set to return a modifying_iterator .

add

Operand type

Parameter type

Result type

set<Type>

Type

Type

Adds an element to the set.

set.add (value);

addAll

Operand type

Parameter type

Result type

set<Type>

sequence<Type>

set<Type>

Adds all elements in the parameter sequence to the set.

set.addAll (seq);

remove

Operand type

Parameter type

Result type

set<Type>

Type

Type

Removes an element from the set.

set.remove (value);

removeAll

Operand type

Parameter type

Result type

set<Type>

sequence<Type>

set<Type>

Removes all elements in the parameter sequence from the set.

set.removeAll (seq);

clear

Operand type

Parameter type

Result type

set<Type>

none

void

Clears all elements from the set.

set.clear;
Last modified: 18 June 2020