SetUtilities<T> extension

Extends Set with additional basic methods.

on

Methods

exclude(Iterable<T> subset) Set<T>
Returns a new list containing all of the elements in this list that aren't also contained within subset.
excludeByIndex(Iterable<int> indexes) Set<T>
Returns a subset containing every element in this set, excluding those at the defined indexes.
getRandom(int count, [int? seed]) Set<T>
Returns a random element from this set.
pluck(int start, [int? end]) Set<T>
Removes and returns a range of elements from this set.
removeFirst() → T
Removes and returns the first element in this set.
removeLast() → T
Removes and returns the last element in this set.
removeRandom([int? seed]) → T
Removes and returns a random element in this set.
removeRange(int start, int end) → void
Removes a range of elements from this set.
shift(int amount) → void
Shifts the order of the elements in this set by the provided amount.
subset(int from, int? to) Set<T>
Returns a new set containing the elements between start and end.

Operators

operator +(Iterable<T> other) Set<T>
Returns a new Set from this with other's elements appended to the end.