Set¶
Definition¶
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, "false" if not. |
Collection | addAll(valuesToAdd) | Object | Adds all elements contained in the iterable 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 container's objects. Methods are defined in the Iterator class. |
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 sorted list of the specified collection. Sorting is done according to the elements' type's 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 string of 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 according to the Boolean flags set by the user. Each Boolean flag determines which portions of the Venn 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 ... | values contained in set |
Example 1¶
Example 2¶
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, "false" if not.
Parameter Definition¶
Name | Type | Description |
---|---|---|
values | Object ... | values to add |
Example 1¶
Example 2¶
addAll(valuesToAdd)¶
Object Collection::addAll(Iterable valuesToAdd)
Description¶
Adds all elements contained in the iterable to this collection
Parameter Definition¶
Name | Type | Description |
---|---|---|
valuesToAdd | Iterable | The values to add to this collection |
Example 2¶
clear()¶
Boolean Collection::clear()
Description¶
Removes all elements in this collection. Returns "true" if this operation removed at least 1 element, returns "false" if it was empty.
Example 2¶
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 ... | value(s) to check |
Example 1¶
getClassName()¶
Description¶
Returns the string name of this object's class type.
Example 11¶
iterator()¶
Description¶
Returns an iterator over this container's objects. Methods are defined in the Iterator class.
Example 1¶
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 |
Example 1¶
size()¶
Integer Collection::size()
Description¶
Returns the size of this collection
Example 2¶
sort()¶
List Collection::sort()
Description¶
Returns a sorted list of the specified collection. Sorting is done according to the elements' type's natural ordering. This sort is guaranteed to be stable, equal elements will not be reordered as a result of the sort.
Example 2¶
toJson()¶
Description¶
Returns a string of a json representation of this object.
Example 11¶
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 according to the Boolean flags set by the user. Each Boolean flag determines which portions of the Venn 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 |
Example 1¶
this is the set containing elements in s1 and s2, but not in both.
Example 2¶
this is the set containing no elements from s1 and only elements from s2 that are also not in s1.