Skip to content
Reference > Classes

Set

Definition

Set var = .... ;

Extends

Extended By

None

Description

A mutable collection of unique data entries. Attempts to add duplicates will be ignored. Entries are stored in the order inserted (Backed by Java LinkedHashSet)

Method Summary

Owner Name Return Type Description
Set constructor(value) Set Construct a new set, duplicate values will be omitted
Set add(values) Boolean Adds all supplied values if they don't already exist. Returns true if the set changed as a result of this call
Collection addAll(valuesToAdd) Object adds all elements to this collection
Collection clear() Boolean Removes all elements in this collection. Returns true if this operation removed at least 1 element, returns false if it was empty
Set contains(value) Boolean Returns true if the set contains ANY of the supplied values
Object getClassName() String Returns the string name of this object's class type.
Iterable iterator() Iterator Returns an iterator over this containers objects
Set remove(values) Boolean Remove all supplied values if they exist. Returns true if the set changed as a result of this call
Collection size() Integer Returns the size of this collection
Collection sort() List Returns a list with the specified collection sorted according the elements' natural ordering. This sort is guaranteed to be stable: equal elements will not be reordered as a result of the sort
Object toJson() String Returns a json representation of this object.
Set venn(otherSet, inThis, inOther, inBoth) Set Returns a new set of values which is a combination of this set and the other set. Consider the two sets comprising a venn diagram and the three boolean flags determining which portions of the diagram are included in the final set

Method Definitions


constructor(value)

Set set = new Set(Object ... value)

Description

Construct a new set, duplicate values will be omitted

Parameter Definition

Name Type Description
value Object ... 

add(values)

Boolean Set::add(Object ... values)

Description

Adds all supplied values if they don't already exist. Returns true if the set changed as a result of this call

Parameter Definition

Name Type Description
values Object ...  values to add

contains(value)

Boolean Set::contains(Object ... value)

Description

Returns true if the set contains ANY of the supplied values

Parameter Definition

Name Type Description
value Object ... 

remove(values)

Boolean Set::remove(Object ... values)

Description

Remove all supplied values if they exist. Returns true if the set changed as a result of this call

Parameter Definition

Name Type Description
values Object ...  values to remove

venn(otherSet,inThis,inOther,inBoth)

Set Set::venn(Set otherSet, Boolean inThis, Boolean inOther, Boolean inBoth)

Description

Returns a new set of values which is a combination of this set and the other set. Consider the two sets comprising a venn diagram and the three boolean flags determining which portions of the diagram are included in the final set

Parameter Definition

Name Type Description
otherSet Set  the other set, that along with this set constitutes a Venn diagram
inThis Boolean  include values that are only in this set
inOther Boolean  include values that are only in the other set
inBoth Boolean  include values that are in both sets