ISetImpl<T> class

Inheritance
Available Extensions
Annotations
  • @immutable

Constructors

ISetImpl.unsafe(Set<T> set, {required ConfigSet config})

Properties

anyItem → T
Returns any item from the set. This is useful if you need to read some property that you know all items in the set have.
no setterinherited
config ConfigSet
The set configuration (ConfigSet).
finalgetter/setter pairinherited-setteroverride-getter
first → T
  • If the set's config has ConfigSet.sort true, will return the first element in the natural order of items. Note: This is not a fast operation, as ISets are not naturally sorted.
  • If the set's config has ConfigSet.sort false (the default), or if the items are not Comparable, the first item by insertion will be returned.
  • no setterinherited
    firstOrNull → T?
    Returns the first element, or null if the set is empty.
    no setterinherited
    flush ISet<T>
    Flushes the set, if necessary. Chainable method. If the set is already flushed, don't do anything.
    no setteroverride
    hashCode int
    The hash code for this object.
    no setterinherited
    isDeepEquals bool
    See also: ConfigList
    no setterinherited
    isEmpty bool
    Returns true if there are no elements in this collection.
    no setterinherited
    isFlushed bool
    Whether this set is already flushed or not.
    no setterinherited
    isIdentityEquals bool
    See also: ConfigList
    no setterinherited
    isNotEmpty bool
    Returns true if there is at least one element in this collection.
    no setterinherited
    iterator Iterator<T>
  • If the set's config has ConfigSet.sort true, it will iterate in the natural order of items. In other words, if the items are Comparable, they will be sorted by a.compareTo(b).
  • If the set's config has ConfigSet.sort false (the default), or if the items are not Comparable, the iterator order is the insertion order.
  • no setterinherited
    last → T
  • If the set's config has ConfigSet.sort true, will return the last element in the natural order of items. Note: This is not a fast operation, as ISets are not naturally sorted.
  • If the set's config has ConfigSet.sort false (the default), or if the items are not Comparable, the last item by insertion will be returned.
  • no setterinherited
    lastOrNull → T?
    Returns the last element, or null if the set is empty.
    no setterinherited
    length int
    The number of objects in this set.
    no setterinherited
    runtimeType Type
    A representation of the runtime type of the object.
    no setterinherited
    single → T
    Checks that this iterable has only one element, and returns that element. Throws a StateError if the set is empty or has more than one element.
    no setterinherited
    singleOrNull → T?
    Checks that the set has only one element, and returns that element. Return null if the set is empty or has more than one element.
    no setterinherited
    unlock Set<T>
    Unlocks the set, returning a regular (mutable, ordered) Set of type LinkedHashSet. This set is "safe", in the sense that is independent from the original ISet.
    no setterinherited
    unlockLazy Set<T>
    Unlocks the set, returning a safe, modifiable (mutable) Set. Using this is very fast at first, since it makes no copies of the ISet items. However, if and only if you use a method that mutates the set, like add, it will unlock internally (make a copy of all ISet items). This is transparent to you, and will happen at most only once. In other words, it will unlock the ISet, lazily, only if necessary. If you never mutate the set, it will be very fast to lock this set back into an ISet.
    no setterinherited
    unlockView Set<T>
    Unlocks the set, returning a safe, unmodifiable (immutable) Set view. The word "view" means the set is backed by the original ISet. Using this is very fast, since it makes no copies of the ISet items. However, if you try to use methods that modify the set, like add, it will throw an UnsupportedError. It is also very fast to lock this set back into an ISet.
    no setterinherited
    withDeepEquals ISet<T>
    Creates a set with deepEquals (compares all set items by equality).
    no setterinherited
    withIdentityEquals ISet<T>
    Creates a set with identityEquals (compares the internals by identity).
    no setterinherited

    Methods

    add(T item) ISet<T>
    Returns a new set containing the current set plus the given item.
    inherited
    addAll(Iterable<T>? items) ISet<T>
    Returns a new set containing the current set plus all the given items.
    inherited
    any(Predicate<T> test) bool
    Checks whether any element of this iterable satisfies test.
    inherited
    cast<R>() Iterable<R>
    Returns an iterable of R instances. If this set contains instances which cannot be cast to R, it will throw an error.
    inherited
    clear() ISet<T>
    Returns an empty set with the same configuration.
    inherited
    contains(covariant T? element) bool
    Returns true if the collection contains an element equal to element, false otherwise.
    inherited
    containsAll(Iterable<T> other) bool
    Returns whether this ISet contains all the elements of other.
    inherited
    difference(Iterable<T> other) ISet<T>
    Returns a new set with the elements of this that are not in other.
    inherited
    elementAt(int index) → T
    Returns the indexth element.
    inherited
    equalItems(covariant Iterable? other) bool
    Will return true only if the ISet has the same number of items as the iterable, and the ISet items are equal to the iterable items, in whatever order. This may be slow for very large sets, since it compares each item, one by one.
    inherited
    equalItemsAndConfig(ISet? other) bool
    Will return true only if the set items are equal and the set configurations are equal. This may be slow for very large sets, since it compares each item, one by one.
    inherited
    every(Predicate<T> test) bool
    Checks whether every element of this iterable satisfies test.
    inherited
    expand<E>(Iterable<E> f(T), {ConfigSet? config}) Iterable<E>
    Expands each element of this ISet into zero or more elements.
    inherited
    firstOr(T orElse) → T
    Returns the first element, or orElse if the set is empty.
    inherited
    firstWhere(Predicate<T> test, {T orElse()?}) → T
    Iterates through elements and returns the first to satisfy test.
    inherited
    fold<E>(E initialValue, E combine(E previousValue, T element)) → E
    Reduces a collection to a single value by iteratively combining eac element of the collection with an existing value.
    inherited
    followedBy(Iterable<T> other) Iterable<T>
    Returns the lazy concatenation of this iterable and other.
    inherited
    forEach(void f(T element)) → void
    Applies the function f to each element of this collection in iteration order.
    inherited
    intersection(Iterable<T> other) ISet<T>
    Returns 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 with the separator in-between each concatenation.
    inherited
    lastOr(T orElse) → T
    Returns the last element, or orElse if the set is empty.
    inherited
    lastWhere(Predicate<T> test, {T orElse()?}) → T
    Returns the last element that satisfies the given predicate test.
    inherited
    lengthCompare(Iterable others) bool
    Compare with others length
    inherited
    lookup(T element) → T?
    If an object equal to object is in the set, return it.
    inherited
    map<E>(E f(T element), {ConfigSet? config}) Iterable<E>
    Returns an Iterable with elements that are created by calling f on each element of this ISet in iteration order.
    inherited
    noSuchMethod(Invocation invocation) → dynamic
    Invoked when a nonexistent method or property is accessed.
    inherited
    reduce(T combine(T value, T element)) → T
    Reduces a collection to a single value by iteratively combining elements of the collection using the provided function.
    inherited
    remove(T item) ISet<T>
    Returns a new set containing the current set minus the given item. However, if the given item didn't exist in the current set, it will return the current set (same instance).
    inherited
    removeAll(Iterable<Object?> elements) ISet<T>
    Removes each element of elements from this set.
    inherited
    removeWhere(Predicate<T> test) ISet<T>
    Removes all elements of this set that satisfy test.
    inherited
    retainAll(Iterable<Object?> elements) ISet<T>
    Removes all elements of this set that are not elements in elements.
    inherited
    retainWhere(Predicate<T> test) ISet<T>
    Removes all elements of this set that fail to satisfy test.
    inherited
    same(ISet<T>? other) bool
    Will return true only if the sets internals are the same instances (comparing by identity). This will be fast even for very large sets, since it doesn't compare each item.
    inherited
    singleOr(T orElse) → T
    Checks if the set has only one element, and returns that element. Return null if the set is empty or has more than one element.
    inherited
    singleWhere(Predicate<T> test, {T orElse()?}) → T
    Returns the single element that satisfies test.
    inherited
    skip(int count) Iterable<T>
    Returns an ISet that provides all but the first count elements.
    inherited
    skipWhile(bool test(T value)) Iterable<T>
    Returns an ISet that skips leading elements while test is satisfied.
    inherited
    take(int count) Iterable<T>
    Returns an ISet of the count first elements of this iterable.
    inherited
    takeWhile(bool test(T value)) Iterable<T>
    Returns an ISet of the leading elements satisfying test.
    inherited
    toggle(T item) ISet<T>
    Removes the element, if it exists in the set. Otherwise, adds it to the set.
    inherited
    toIList({int compare(T a, T b)?, ConfigList? config}) IList<T>
    Returns a IList with all items from the set.
    inherited
    toJson(Object? toJsonT(T)) Object
    Converts to JSon. Json serialization support for json_serializable with @JsonSerializable.
    inherited
    toList({bool growable = true, int compare(T a, T b)?}) List<T>
    Returns a List with all items from the set.
    inherited
    toSet({int compare(T a, T b)?}) Set<T>
    Returns a Set with all items from the ISet.
    inherited
    toString([bool? prettyPrint]) String
    Returns a string representation of (some of) the elements of this.
    inherited
    union(Iterable<T> other) ISet<T>
    Returns a new set which contains all the elements of this set and other.
    inherited
    unorderedEqualItems(covariant Iterable? other) bool
    Will return true only if the ISet and the iterable items have the same number of elements, and the elements of the ISet can be paired with the elements of the iterable, so that each pair is equal. This may be slow for very large sets, since it compares each item, one by one.
    inherited
    where(Predicate<T> test) Iterable<T>
    Returns an ISet with all elements that satisfy the predicate test.
    inherited
    whereType<E>() Iterable<E>
    Returns an ISet with all elements that have type E.
    inherited
    withConfig(ConfigSet config) ISet<T>
    Creates a new set with the given config.
    inherited
    withConfigFrom(ISet<T> other) ISet<T>
    Returns a new set with the contents of the present ISet, but the config of other.
    inherited

    Operators

    operator +(Iterable<T> other) ISet<T>
    Returns the concatenation of this set and other. Returns a new set containing the elements of this set followed by the elements of other.
    inherited
    operator ==(Object other) bool
  • If isDeepEquals configuration is true: Will return true only if the set items are equal (and in the same order), and the set configurations are equal. This may be slow for very large sets, since it compares each item, one by one.

  • If isDeepEquals configuration is false: Will return true only if the sets internals are the same instances (comparing by identity). This will be fast even for very large sets, since it doesn't compare each item.

  • inherited
    operator [](int index) → T
    Returns the indexth element.
    inherited

    Static Methods

    empty<T>([ConfigSet? config]) ISetImpl<T>
    Returns an empty ISet, with the given configuration. If a configuration is not provided, it will use the default configuration.