BuiltSet<E> class
Null safety
The Built Collection Set.
It implements Iterable and the non-mutating part of the Set interface. Iteration is in the same order in which the elements were inserted. Modifications are made via SetBuilder.
See the Built Collection library documentation for the general properties of Built Collections.
- Implemented types
- Available Extensions
Constructors
- BuiltSet([Iterable iterable = const []])
-
Instantiates with elements from an Iterable.
factory
-
BuiltSet.build(dynamic updates(SetBuilder<
E> )) -
Creates a SetBuilder, applies updates to it, and builds.
factory
- BuiltSet.from(Iterable iterable)
-
Instantiates with elements from an Iterable.
factory
-
BuiltSet.of(Iterable<
E> iterable) -
Instantiates with elements from an Iterable<E>.
factory
Properties
- first → E
-
Returns the first element.
read-onlyoverride
- hashCode → int
-
Deep hashCode.
read-onlyoverride
- isEmpty → bool
-
Whether this collection has no elements.
read-onlyoverride
- isNotEmpty → bool
-
Whether this collection has at least one element.
read-onlyoverride
-
iterator
→ Iterator<
E> -
Returns a new
Iterator
that allows iterating the elements of thisIterable
.read-onlyoverride - last → E
-
Returns the last element.
read-onlyoverride
- length → int
-
As Set.length.
read-onlyoverride
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
- single → E
-
Checks that this iterable has only one element, and returns that element.
read-onlyoverride
Methods
-
any(
bool test(E)) → bool -
Checks whether any element of this iterable satisfies
test
.override -
asSet(
) → Set< E> - Returns as an immutable set.
-
cast<
T> () → Iterable< T> -
Provides a view of this iterable as an iterable of
R
instances.override -
contains(
Object? element) → bool -
Whether the collection contains an element equal to
element
.override -
containsAll(
Iterable< Object?> other) → bool - As Set.containsAll.
-
difference(
BuiltSet< Object?> other) → BuiltSet<E> -
As Set.difference but takes a
BuiltSet<Object?>
and returns aBuiltSet<E>
. -
elementAt(
int index) → E -
Returns the
index
th element.override -
every(
bool test(E)) → bool -
Checks whether every element of this iterable satisfies
test
.override -
expand<
T> (Iterable< T> f(E)) → Iterable<T> -
Expands each element of this Iterable into zero or more elements.
override
-
firstWhere(
bool test(E), {E orElse()?}) → E -
Returns the first element that satisfies the given predicate
test
.override -
fold<
T> (T initialValue, T combine(T, E)) → T -
Reduces a collection to a single value by iteratively combining each
element of the collection with an existing value
override
-
followedBy(
Iterable< E> other) → Iterable<E> -
Returns the lazy concatenation of this iterable and
other
.override -
forEach(
void f(E)) → void -
Invokes
action
on each element of this iterable in iteration order.override -
intersection(
BuiltSet< Object?> other) → BuiltSet<E> -
As Set.intersection but takes a
BuiltSet<Object?>
and returns aBuiltSet<E>
. -
join(
[String separator = '']) → String -
Converts each element to a String and concatenates the strings.
override
-
lastWhere(
bool test(E), {E orElse()?}) → E -
Returns the last element that satisfies the given predicate
test
.override -
lookup(
Object? object) → E? - As Set.lookup.
-
map<
T> (T f(E)) → Iterable< T> -
The current elements of this iterable modified by
toElement
.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed.
inherited
-
rebuild(
dynamic updates(SetBuilder< E> )) → BuiltSet<E> - Converts to a SetBuilder, applies updates to it, and builds.
-
reduce(
E combine(E, E)) → E -
Reduces a collection to a single value by iteratively combining elements
of the collection using the provided function.
override
-
singleWhere(
bool test(E), {E orElse()?}) → E -
Returns the single element that satisfies
test
.override -
skip(
int n) → Iterable< E> -
Returns an Iterable that provides all but the first
count
elements.override -
skipWhile(
bool test(E)) → Iterable< E> -
Returns an
Iterable
that skips leading elements whiletest
is satisfied.override -
take(
int n) → Iterable< E> -
Returns a lazy iterable of the
count
first elements of this iterable.override -
takeWhile(
bool test(E)) → Iterable< E> -
Returns a lazy iterable of the leading elements satisfying
test
.override -
toBuilder(
) → SetBuilder< E> - Converts to a SetBuilder for modification.
-
toBuiltList(
) → BuiltList< E> - Converts to a BuiltList.
-
toBuiltSet(
) → BuiltSet< E> - Converts to a BuiltSet.
-
toList(
{bool growable = true}) → List< E> -
Creates a List containing the elements of this Iterable.
override
-
toSet(
) → Set< E> -
As Iterable.toSet.
override
-
toString(
) → String -
A string representation of this object.
override
-
union(
BuiltSet< E> other) → BuiltSet<E> -
As Set.union but takes and returns a
BuiltSet<E>
. -
where(
bool test(E)) → Iterable< E> -
Returns a new lazy Iterable with all elements that satisfy the
predicate
test
.override -
whereType<
T> () → Iterable< T> -
Returns a new lazy Iterable with all elements that have type
T
.override
Operators
-
operator ==(
Object other) → bool -
Deep equality.
override