FromISetMixin<T, I extends FromISetMixin<T, I> > mixin
This mixin implements all ISet members (without config), but it does NOT implement Iterable nor ISet.
It is meant to help you wrap an ISet into another class (composition). You must override the iter getter to return the inner ISet. All other methods are efficiently implemented in terms of the iter.
To use this mixin, your class must:
- Override the iter getter to return the inner ISet.
- Override the newInstance method to return a new instance of the class.
Example:
class Students with FromISetMixin<Student, Students> {
final ISet<Student> _students;
Students([Iterable<Student> students]) : _students = ISet(students);
Students newInstance(ISet<Student> iset) => Students(iset);
ISet<Student> get iter => _students;
}
class Student implements Comparable<Student> {
final String name;
const Student(this.name);
String toString() => "Student: $name";
bool operator ==(Object other) =>
identical(this, other) ||
other is Student &&
runtimeType == other.runtimeType &&
name == other.name;
int get hashCode => name.hashCode;
int compareTo(Student other) => name.compareTo(other.name);
}
See also: FromIterableISetMixin.
- Implemented types
Properties
- first → T
-
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- isEmpty → bool
-
no setteroverride
- isNotEmpty → bool
-
no setteroverride
-
iter
→ ISet<
T> -
Classes
with
FromISetMixin must override this.no setter -
iterator
→ Iterator<
T> -
no setter
- last → T
-
no setter
- length → int
-
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- single → T
-
no setter
-
unlock
→ Set<
T> -
no setter
-
unlockView
→ Set<
T> -
no setter
Methods
-
add(
T item) → I -
addAll(
Iterable< T> items) → I -
any(
Predicate< T> test) → bool -
cast<
R> () → Iterable< R> -
clear(
) → I -
contains(
covariant T? element) → bool -
containsAll(
Iterable< T> other) → bool -
difference(
Set< T> other) → ISet<T> -
elementAt(
int index) → T -
equalItems(
covariant Iterable< T> other) → bool -
every(
Predicate< T> test) → bool -
expand<
E> (Iterable< E> f(T)) → Iterable<E> -
firstWhere(
Predicate< T> test, {T orElse()?}) → T -
fold<
E> (E initialValue, E combine(E previousValue, T element)) → E -
followedBy(
Iterable< T> other) → Iterable<T> -
forEach(
void f(T element)) → void -
intersection(
Set< T> other) → ISet<T> -
join(
[String separator = ""]) → String -
lastWhere(
Predicate< T> test, {T orElse()?}) → T -
lookup(
T element) → T? -
map<
E> (E f(T element)) → Iterable< E> -
newInstance(
ISet< T> iset) → I -
Classes
with
FromISetMixin must override this. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
reduce(
T combine(T value, T element)) → T -
remove(
T item) → I -
removeAll(
Iterable< T> elements) → ISet<T> -
removeWhere(
Predicate< T> test) → I -
retainAll(
Iterable< T> elements) → ISet<T> -
retainWhere(
Predicate< T> test) → I -
same(
I other) → bool -
singleWhere(
Predicate< T> test, {T orElse()?}) → T -
skip(
int count) → Iterable< T> -
skipWhile(
bool test(T value)) → Iterable< T> -
take(
int count) → Iterable< T> -
takeWhile(
bool test(T value)) → Iterable< T> -
toggle(
T element) → I -
toList(
{bool growable = true}) → List< T> -
toSet(
) → Set< T> -
toString(
) → String -
A string representation of this object.
override
-
union(
Set< T> other) → ISet<T> -
where(
Predicate< T> test) → Iterable<T> -
whereType<
E> () → Iterable< E>
Operators
-
operator +(
Iterable< T> other) → I -
operator ==(
Object other) → bool -
The equality operator.
inherited