AdaptableSet class final

A specialized set collection that can adapt itself or another source into a strongly-typed Set of elements.

The AdaptableSet extends HashSet<Object> and provides a generic adapt method that converts:

Purpose

This class is intended to:

  • Facilitate type-safe conversion for heterogeneous sets.
  • Enable framework-level or service-level collection adaptation.
  • Provide a consistent API across JetLeaf and standard Dart collections.

Features

Lifecycle and Usage

final adaptable = AdaptableSet();
adaptable.addAll([1, 2, 3]);
final typedSet = adaptable.adapt<int>(); // Set<int>

final source = collection.HashSet<dynamic>();
source.addAll(['a', 'b']);
final stringSet = adaptable.adapt<String>(source); // Set<String>

Extensibility

  • Subclass to provide custom element conversion rules.
  • Integrate with conversion services for automatic type transformations.

Error Handling

See Also

Inheritance
Available extensions

Constructors

AdaptableSet()
A specialized set collection that can adapt itself or another source into a strongly-typed Set of elements.
AdaptableSet.create(List<Object> entries)
A specialized set collection that can adapt itself or another source into a strongly-typed Set of elements.
factory

Properties

first Object
The first element.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
isEmpty bool
Whether this collection has no elements.
no setterinherited
isNotEmpty bool
Whether this collection has at least one element.
no setterinherited
iterator Iterator<Object>
An iterator that iterates over the elements of this set.
no setterinherited
last Object
The last element.
no setterinherited
length int
The number of elements in this Iterable.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
single Object
Checks that this iterable has only one element, and returns that element.
no setterinherited
wait Future<List<T>>

Available on Iterable<Future<T>>, provided by the FutureIterable extension

Waits for futures in parallel.
no setter

Methods

adapt<E>([Object? source]) Set<E>
Converts the given source or this into a strongly-typed Set<E>.
add(Object element) bool
Adds value to the set.
inherited
addAll(Iterable<Object> elements) → void
Adds all elements to this set.
inherited
any(bool test(Object element)) bool
Checks whether any element of this iterable satisfies test.
inherited
asNameMap() Map<String, T>

Available on Iterable<T>, provided by the EnumByName extension

Creates a map from the names of enum values to the values.
byName(String name) → T

Available on Iterable<T>, provided by the EnumByName extension

Finds the enum value in this list with name name.
cast<R>() Set<R>
Provides a view of this set as a set of R instances.
inherited
clear() → void
Removes all elements from the set.
inherited
contains(Object? element) bool
Whether value is in the set.
inherited
containsAll(Iterable<Object?> other) bool
Whether this set contains all the elements of other.
inherited
difference(Set<Object?> other) Set<Object>
Creates a new set with the elements of this that are not in other.
inherited
elementAt(int index) Object
Returns the indexth element.
inherited
every(bool test(Object element)) bool
Checks whether every element of this iterable satisfies test.
inherited
expand<T>(Iterable<T> toElements(Object element)) Iterable<T>
Expands each element of this Iterable into zero or more elements.
inherited
firstWhere(bool test(Object element), {Object orElse()?}) Object
The first element that satisfies the given predicate test.
inherited
fold<T>(T initialValue, T combine(T previousValue, Object element)) → T
Reduces a collection to a single value by iteratively combining each element of the collection with an existing value
inherited
followedBy(Iterable<Object> other) Iterable<Object>
Creates the lazy concatenation of this iterable and other.
inherited
forEach(void action(Object element)) → void
Invokes action on each element of this iterable in iteration order.
inherited
intersection(Set<Object?> other) Set<Object>
Creates a new set which is the intersection between this set and other.
inherited
join([String separator = ""]) String
Converts each element to a String and concatenates the strings.
inherited
lastWhere(bool test(Object element), {Object orElse()?}) Object
The last element that satisfies the given predicate test.
inherited
lookup(Object? element) Object?
If an object equal to object is in the set, return it.
inherited
map<T>(T toElement(Object e)) Iterable<T>
The current elements of this iterable modified by toElement.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reduce(Object combine(Object value, Object element)) Object
Reduces a collection to a single value by iteratively combining elements of the collection using the provided function.
inherited
remove(Object? value) bool
Removes value from the set.
inherited
removeAll(Iterable<Object?> elements) → void
Removes each element of elements from this set.
inherited
removeWhere(bool test(Object element)) → void
Removes all elements of this set that satisfy test.
inherited
retainAll(Iterable<Object?> elements) → void
Removes all elements of this set that are not elements in elements.
inherited
retainWhere(bool test(Object element)) → void
Removes all elements of this set that fail to satisfy test.
inherited
singleWhere(bool test(Object element), {Object orElse()?}) Object
The single element that satisfies test.
inherited
skip(int count) Iterable<Object>
Creates an Iterable that provides all but the first count elements.
inherited
skipWhile(bool test(Object value)) Iterable<Object>
Creates an Iterable that skips leading elements while test is satisfied.
inherited
sortedByPublicFirst() List<T>

Available on Iterable<T>, provided by the SortByPublic extension

Sorts declarations with public visibility before private ones.
sortedByPublicFirstThenSyntheticLast() List<T>

Available on Iterable<T>, provided by the SortByPublic extension

Sorts declarations with public visibility first and synthetic declarations last.
take(int count) Iterable<Object>
Creates a lazy iterable of the count first elements of this iterable.
inherited
takeWhile(bool test(Object value)) Iterable<Object>
Creates a lazy iterable of the leading elements satisfying test.
inherited
toList({bool growable = true}) List<Object>
Creates a List containing the elements of this Iterable.
inherited
toSet() Set<Object>
Creates a Set with the same elements and behavior as this Set.
inherited
toString() String
A string representation of this object.
inherited
union(Set<Object> other) Set<Object>
Creates a new set which contains all the elements of this set and other.
inherited
where(bool test(Object element)) Iterable<Object>
Creates a new lazy Iterable with all elements that satisfy the predicate test.
inherited
whereType<T>() Iterable<T>
Creates a new lazy Iterable with all elements that have type T.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

CLASS Class<AdaptableMap>
Represents the metadata class for AdaptableMap.
final