IList<T> class
abstract
- Inheritance
-
- Object
- ImmutableCollection<
IList< T> > - IList
- Implemented types
-
- Iterable<
T>
- Iterable<
- Available extensions
- Annotations
-
- @immutable
Constructors
-
IList.new([Iterable<
T> ? iterable]) -
Create an IList from an
iterable
, with the default configuration. Fast, if the iterable is another IList.factory -
IList.fromISet(ISet<
T> iset, {int compare(T a, T b)?, required ConfigList? config}) -
Special IList constructor from ISet.
factory
- IList.fromJson(dynamic json, T fromJsonT(Object?))
-
Converts from JSon. Json serialization support for json_serializable with @JsonSerializable.
factory
-
IList.unsafe(List<
T> list, {required ConfigList config}) -
Unsafe constructor. Use this at your own peril.
factory
-
IList.withConfig(Iterable<
T> ? iterable, ConfigList config) -
Create an IList from any Iterable and a ConfigList.
Fast, if the Iterable is another IList.
If
iterable
is null, return an empty IList.factory
Properties
-
asComparableEntries
→ Iterable<
Entry< K, V> > -
Available on Iterable<
MapEntry is not Comparable. If you need to compare two iterables of MapEntry you can do this:MapEntry< , provided by the FicIterableOfMapEntryExtension extensionK, V> >no setter -
collect
→ ZIO<
R, E, IList< A> > -
Available on Iterable<
Alias for ZIO.collectIZIO< , provided by the ZIOIterableExt extensionR, E, A> >no setter -
collectDiscard
→ ZIO<
R, E, Unit> -
Available on Iterable<
Alias for ZIO.collectDiscardIZIO< , provided by the ZIOIterableExt extensionR, E, A> >no setter -
collectPar
→ ZIO<
R, E, IList< A> > -
Available on Iterable<
Alias for ZIO.collectParIZIO< , provided by the ZIOIterableExt extensionR, E, A> >no setter -
collectParDiscard
→ ZIO<
R, E, Unit> -
Available on Iterable<
Alias for ZIO.collectParDiscardIZIO< , provided by the ZIOIterableExt extensionR, E, A> >no setter - config → ConfigList
-
no setter
- first → T
-
Returns the first element.
Throws a StateError if the list is empty.
no setteroverride
-
firstOption
→ Option<
T> -
Available on Iterable<
Get the first element of the Iterable. If the Iterable is empty, return None.T> , provided by the ElementalOnIterable extensionno setter - firstOrNull → T?
-
Available on Iterable<
The first element of this iterator, orT> , provided by the IterableExtensions extensionnull
if the iterable is empty.no setter - firstOrNull → T?
-
Returns the first element, or
null
if the list is empty.no setter -
flatten
→ Iterable<
T> -
Available on Iterable<
From aIterable< , provided by the ElementalOnIterableOfIterable extensionT> >Iterable<Iterable<T>>
return aIterable<T>
of their concatenation.no setter -
flush
→ IList<
T> -
Flushes the list, if necessary. Chainable getter.
If the list is already flushed, don't do anything.
no setteroverride
- hashCode → int
-
The hash code for this object.
no setteroverride
- head → T
-
Returns the first element of this Iterable
no setter
-
head
→ Option<
T> -
Available on Iterable<
Get the first element of the Iterable. If the Iterable is empty, return None.T> , provided by the ElementalOnIterable extensionno setter -
indexed
→ Iterable<
(int, T)> -
Available on Iterable<
Pairs of elements of the indices and elements of this iterable.T> , provided by the IterableExtensions extensionno setter -
init
→ Iterable<
T> -
Returns an Iterable that is the original iterable without the last element
no setter
-
init
→ Option<
Iterable< T> > -
Available on Iterable<
Return all the elements of a Iterable except the last one. If the Iterable is empty, return None.T> , provided by the ElementalOnIterable extensionno setter - isDeepEquals → bool
-
See also: ConfigList
no setter
- isEmpty → bool
-
Returns
true
if there are no elements in this collection.no setteroverride - isFlushed → bool
-
Whether this list is already flushed or not.
no setteroverride
- isIdentityEquals → bool
-
See also: ConfigList
no setter
- isNotEmpty → bool
-
Returns
true
if there is at least one element in this collection.no setteroverride -
iterator
→ Iterator<
T> -
Returns a new
Iterator
that allows iterating the elements of this IList.no setteroverride - last → T
-
Returns the last element.
Throws a StateError if the list is empty.
no setteroverride
-
lastOption
→ Option<
T> -
Available on Iterable<
Get the last element of the Iterable. If the Iterable is empty, return None.T> , provided by the ElementalOnIterable extensionno setter - lastOrNull → T?
-
Returns the last element, or
null
if the list is empty.no setter - lastOrNull → T?
-
Available on Iterable<
The last element of this iterable, orT> , provided by the IterableExtensions extensionnull
if the iterable is empty.no setter - length → int
-
The number of objects in this list.
no setteroverride
-
nonNulls
→ Iterable<
T> -
Available on Iterable<
The non-T?> , provided by the NullableIterableExtensions extensionnull
elements of this iterable.no setter -
raceAll
→ ZIO<
R, E, A> -
Available on Iterable<
Alias for ZIO.raceAllIZIO< , provided by the ZIOIterableExt extensionR, E, A> >no setter -
reversed
→ IList<
T> -
Returns an Iterable of the objects in this list in reverse order.
no setter
- 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 list is empty or has more than one element.
no setteroverride
- singleOrNull → T?
-
Checks that the list has only one element, and returns that element.
Return
null
if the list is empty or has more than one element.no setter - singleOrNull → T?
-
Available on Iterable<
The single element of this iterator, orT> , provided by the IterableExtensions extensionnull
.no setter -
tail
→ Option<
Iterable< T> > -
Available on Iterable<
Return all the elements of a Iterable except the first one. If the Iterable is empty, return None.T> , provided by the ElementalOnIterable extensionno setter -
tail
→ Iterable<
T> -
Returns an Iterable that is the original iterable without head, aka first element
no setter
-
unlock
→ List<
T> -
Unlocks the list, returning a regular (mutable, growable) List. This
list is "safe", in the sense that is independent from the original IList.
no setter
-
unlockLazy
→ List<
T> -
Unlocks the list, returning a safe, modifiable (mutable) List.
Using this is very fast at first, since it makes no copies of the IList
items. However, if and only if you use a method that mutates the list,
like add, it will unlock internally (make a copy of all IList items). This is
transparent to you, and will happen at most only once. In other words,
it will unlock the IList, lazily, only if necessary.
If you never mutate the list, it will be very fast to lock this list
back into an IList.
no setter
-
unlockView
→ List<
T> -
Unlocks the list, returning a safe, unmodifiable (immutable) List view.
The word "view" means the list is backed by the original IList.
Using this is very fast, since it makes no copies of the IList items.
However, if you try to use methods that modify the list, like add,
it will throw an UnsupportedError.
It is also very fast to lock this list back into an IList.
no setter
-
wait
→ Future<
List< T> > -
Available on Iterable<
Waits for futures in parallel.Future< , provided by the FutureIterable extensionT> >no setter -
withDeepEquals
→ IList<
T> -
Creates a list with
deepEquals
(compares all list items by equality).no setter -
withIdentityEquals
→ IList<
T> -
Creates a list with
identityEquals
(compares the internals byidentity
).no setter
Methods
-
add(
T item) → IList< T> -
Return a new list with
item
added to the end of the current list, (thus extending the length by one). -
addAll(
Iterable< T> items) → IList<T> -
Returns a new list with all
items
added to the end of the current list, (thus extending the length by the length of items). -
all(
bool test(T t)) → bool -
Available on Iterable<
Checks whether every element of this Iterable satisfiesT> , provided by the ElementalOnIterable extensiontest
. -
any(
Predicate< T> test) → bool -
Checks whether any element of this iterable satisfies
test
.override -
anyIs(
T value) → bool -
Available on Iterable<
ReturnsT> , provided by the FicIterableExtension extensiontrue
if any item is equal tovalue
. -
ap<
B> (Iterable< B Function(T)> iterable) → Iterable<B> -
Available on Iterable<
Apply all the functions insideT> , provided by the ElementalOnIterable extensioniterable
to this Iterable. -
append(
T element) → Iterable< T> -
Available on Iterable<
InsertT> , provided by the ElementalOnIterable extensionelement
at the end of the Iterable. -
asList(
) → List< T> -
Available on Iterable<
Returns a List containing the elements of this iterable. If the Iterable is already a List, return the same instance (nothing new is created). Otherwise, create a new List from it. See also: Dart's native toList, which always creates a new list.T> , provided by the FicIterableExtension extension -
asMap(
) → IMap< int, T> -
Returns an IMap view of this list.
The map uses the indices of this list as keys and the corresponding objects
as values. The
Map.keys
Iterable iterates the indices of this list in numerical order. -
asNameMap(
) → Map< String, T> -
Available on Iterable<
Creates a map from the names of enum values to the values.T> , provided by the EnumByName extension -
asSet(
) → Set< T> -
Available on Iterable<
Creates a Set containing the same elements as this iterable. If the Iterable is already a Set, return the same instance (nothing new is created). Otherwise, create a new Set from it. See also: Dart's native toSet, which always creates a new set.T> , provided by the FicIterableExtension extension -
averageBy<
N extends num> (N mapper(T element)) → double -
Available on Iterable<
The arithmetic mean of the elements of a non-empty iterable. The arithmetic mean is the sum of the elements divided by the number of elements. If iterable is empty it returns 0. Examples:T> , provided by the FicIterableExtension extension -
breakI(
bool test(T t)) → (Iterable< T> , Iterable<T> ) -
Available on Iterable<
Return a record where first element is longest prefix (possibly empty) of this Iterable with elements that do not satisfyT> , provided by the ElementalOnIterable extensiontest
and second element is the remainder of the Iterable. -
byName(
String name) → T -
Available on Iterable<
Finds the enum value in this list with nameT> , provided by the EnumByName extensionname
. -
cast<
R> () → Iterable< R> -
Returns a list of
R
instances. If this list contains instances which cannot be cast toR
, it will throw an error.override -
clear(
) → IList< T> - Returns an empty list with the same configuration.
-
concat(
Iterable< T> other) → Iterable<T> -
Available on Iterable<
Creates the lazy concatenation of this Iterable andT> , provided by the ElementalOnIterable extensionother
. -
contains(
covariant T? element) → bool -
Returns
true
if the collection contains an element equal toelement
,false
otherwise.override -
corresponds<
U> (Iterable< U> others, EQ eq) → bool - Return true if length match and all Eq are true.
-
count(
Predicate< T> p) → int - Positives predicate results count
-
deepEquals(
Iterable? other, {bool ignoreOrder = false}) → bool -
Available on Iterable<
Compare all items, in order or not, according toT> , provided by the FicIterableExtension extensionignoreOrder
, using operator ==. Return true if they are all the same, in the same order. -
deepEqualsByIdentity(
Iterable? other, {bool ignoreOrder = false}) → bool -
Available on Iterable<
Return true if they are all the same, in the same order. Compare all items, in order or not, according toT> , provided by the FicIterableExtension extensionignoreOrder
, using identical. Return true if they are all the same, in the same order. -
delete(
T element) → Iterable< T> -
Available on Iterable<
Remove the first occurrence ofT> , provided by the ElementalOnIterable extensionelement
from this Iterable. -
divideIn2(
bool test(T item)) → IListOf2< IList< T> > -
Divides the list into two.
The first one contains all items which satisfy the provided
test
. The last one contains all the other items. The relative order of the items will be maintained. -
drop(
int n) → Iterable< T> -
Available on Iterable<
Return the suffix of this Iterable after the firstT> , provided by the ElementalOnIterable extensionn
elements. -
dropRight(
[int count = 1]) → Iterable< T> -
Available on Iterable<
Drops the lastT> , provided by the ElementalOnIterable extensioncount
element of this iterable. -
dropWhileLeft(
bool test(T t)) → Iterable< T> -
Available on Iterable<
Remove all elements starting from the first as long asT> , provided by the ElementalOnIterable extensiontest
returnstrue
. -
elem(
T element) → bool -
Available on Iterable<
Check ifT> , provided by the ElementalOnIterable extensionelement
is contained inside this Iterable. -
elementAt(
int index) → T -
Returns the
index
th element. This is the same as using the [] operator. See also: get and getOrNull.override -
elementAtOrNull(
int index) → T? -
Available on Iterable<
The element at positionT> , provided by the IterableExtensions extensionindex
of this iterable, ornull
. -
equalItems(
covariant Iterable? other) → bool -
Will return
true
only if the IList items are equal to the iterable items, and in the same order. This may be slow for very large lists, since it compares each item, one by one. You can compare the list with ordered sets, but unordered sets will throw aStateError
. To compare the IList with unordered sets, try the unorderedEqualItems method.override -
equalItemsAndConfig(
IList? other) → bool -
Will return
true
only if the list items are equal and in the same order, and the list configurations are equal. This may be slow for very large lists, since it compares each item, one by one.override -
every(
Predicate< T> test) → bool -
Checks whether every element of this iterable satisfies
test
.override -
everyIs(
T value) → bool -
Available on Iterable<
ReturnsT> , provided by the FicIterableExtension extensiontrue
if all items are equal tovalue
. -
expand<
E> (Iterable< E> f(T)) → Iterable<E> -
Expands each element of this Iterable into zero or more elements.
override
-
fillRange(
int start, int end, [T? fillValue]) → IList< T> -
Sets the objects in the range
start
inclusive toend
exclusive to the givenfillValue
. -
filter(
bool test(T t)) → Iterable< T> -
Available on Iterable<
Returns the list of those elements that satisfyT> , provided by the ElementalOnIterable extensiontest
. -
filterWithIndex(
bool test(T t, int index)) → Iterable< T> -
Available on Iterable<
Returns the list of those elements that satisfyT> , provided by the ElementalOnIterable extensiontest
. -
findDuplicates(
) → Set< T> -
Available on Iterable<
Finds duplicates and then returns a Set with the duplicated elements. If there are no duplicates, an empty Set is returned.T> , provided by the FicIterableExtension extension -
firstOr(
T orElse) → T -
Returns the first element, or
orElse
if the list is empty. -
firstWhere(
Predicate< T> test, {T orElse()?}) → T -
Iterates through elements and returns the first to satisfy
test
.override -
flatMap<
B> (Iterable< B> toElements(T t)) → Iterable<B> -
Available on Iterable<
For each element of the Iterable apply functionT> , provided by the ElementalOnIterable extensiontoElements
and flat the result. -
flatMapWithIndex<
B> (Iterable< B> toElements(T t, int index)) → Iterable<B> -
Available on Iterable<
Same asT> , provided by the ElementalOnIterable extensionflatMap
(extend
) but provides also theindex
of each mapped element in the mapping function (toElements
). -
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.
override
-
foldLeft<
B> (B initialValue, B combine(B b, T t)) → B -
Available on Iterable<
Fold this Iterable into a single value by aggregating each element of the list from the first to the last.T> , provided by the ElementalOnIterable extension -
foldLeftWithIndex<
B> (B initialValue, B combine(B previousValue, T element, int index)) → B -
Available on Iterable<
Same asT> , provided by the ElementalOnIterable extensionfoldLeft
(fold
) but provides also theindex
of each mapped element in thecombine
function. -
followedBy(
Iterable< T> other) → Iterable<T> -
Returns the lazy concatenation of this iterable and
other
.override -
forEach(
void f(T element)) → void -
Applies the function
f
to each element of this collection in iteration order.override -
get(
int index, {T orElse(int index)?}) → T -
Returns the
index
th element. If that index doesn't exist (negative, or out of range), will return the result of callingorElse
. In this case, iforElse
is not provided, will throw an error. -
getAndMap(
int index, T map(int index, bool inRange, T? value)) → T -
Gets the
index
th element, and then apply themap
function to it, returning the result. If that index doesn't exist (negative, or out of range), will themap
method will be called withinRange
false andvalue
null. -
getOrNull(
int index) → T? -
Returns the
index
th element. If that index doesn't exist (negative or out of range), will return null. This method will never throw an error. -
getRange(
int start, int end) → Iterable< T> -
Returns an Iterable that iterates over the objects in the range
start
inclusive toend
exclusive. -
indexOf(
T element, [int start = 0]) → int -
Returns the index of the first
element
in the list. -
indexWhere(
Predicate< T> test, [int start = 0]) → int -
Returns the first index in the list that satisfies the provided
test
. -
inits(
) → Iterable< Iterable< T> > -
inRange(
int index) → bool -
Returns
true
if the givenindex
is valid (between0
andlength - 1
). -
insert(
int index, T element) → IList< T> -
Inserts the object at position
index
in this list and returns a new immutable list. -
insertAll(
int index, Iterable< T> iterable) → IList<T> -
Inserts all objects of
iterable
at positionindex
in this list. -
insertBy(
Order< T> order, T element) → Iterable<T> -
Available on Iterable<
InsertT> , provided by the ElementalOnIterable extensionelement
into the list at the first position where it is less than or equal to the next element based onorder
(Order). -
insertWith<
A> (A extract(T instance), Order< A> order, T element) → Iterable<T> -
Available on Iterable<
InsertT> , provided by the ElementalOnIterable extensionelement
into the Iterable at the first position where it is less than or equal to the next element based onorder
(Order). -
intersect(
Iterable< T> iterable) → Iterable<T> -
Available on Iterable<
Return the intersection of two Iterable (all the elements that both Iterable have in common).T> , provided by the ElementalOnIterable extension -
intersectsWith(
Iterable< T> other) → bool -
Available on Iterable<
Returns true if this Iterable has any items in common with theT> , provided by the FicIterableExtension extensionother
Iterable. This method is as performant as possible, but it will be faster if any of the Iterables is a Set or an ISet. -
intersperse(
T middle) → Iterable< T> -
Available on Iterable<
Return an Iterable placing anT> , provided by the ElementalOnIterable extensionmiddle
in between elements of the this Iterable. -
isFirst(
T item) → bool -
Available on Iterable<
Return true if the givenT> , provided by the FicIterableExtension extensionitem
is the same (by identity) as the first iterable item. If this iterable is empty, always return null. This is useful for non-indexed loops where you need to know when you have the first item. For example: -
isLast(
T item) → bool -
Available on Iterable<
Return true if the givenT> , provided by the FicIterableExtension extensionitem
is the same (by identity) as the last iterable item. If this iterable is empty, always return null. This is useful for non-indexed loops where you need to know when you have the last item. For example: -
isNotFirst(
T item) → bool -
Available on Iterable<
Return true if the givenT> , provided by the FicIterableExtension extensionitem
is NOT the same (by identity) as the first iterable item. If this iterable is empty, always return null. This is useful for non-indexed loops where you need to know when you don't have the first item. For example: -
isNotLast(
T item) → bool -
Available on Iterable<
Return true if the givenT> , provided by the FicIterableExtension extensionitem
is NOT the same (by identity) as the last iterable item. If this iterable is empty, always return null. This is useful for non-indexed loops where you need to know when you don't have the last item. For example: -
join(
[String separator = ""]) → String -
Converts each element to a String and concatenates the strings with the
separator
in-between each concatenation.override -
lastIndexOf(
T element, [int? start]) → int -
Returns the last index of
element
in this list. -
lastIndexWhere(
Predicate< T> test, [int? start]) → int -
Returns the last index in the list that satisfies the provided
test
. -
lastOr(
T orElse) → T -
Returns the last element, or
orElse
if the list is empty. -
lastWhere(
Predicate< T> test, {T orElse()?}) → T -
Returns the last element that satisfies the given predicate
test
.override -
lengthCompare(
Iterable others) → bool -
Compare with
others
length -
map<
E> (E f(T element), {ConfigList? config}) → Iterable< E> -
Returns a new lazy Iterable with elements that are created by calling
f
on each element of this Iterable in iteration order.override -
mapIndexedAndLast<
R> (R convert(int index, T item, bool isLast)) → Iterable< R> -
Available on Iterable<
Maps each element and its index to a new value. This is similar toT> , provided by the FicIterableExtension extensionmapIndexed
but also tells you which item is the last. -
mapNotNull<
E> (E? f(T? e)) → Iterable< E> -
Available on Iterable<
Similar to map, but MAY return a non-nullable type.T?> , provided by the FicIterableExtensionTypeNullable extension -
mapWithIndex<
B> (B toElement(T t, int index)) → Iterable< B> -
Available on Iterable<
Same asT> , provided by the ElementalOnIterable extensionmap
but provides also theindex
of each mapped element in the mapping function (toElement
). -
maximumBy(
Order< T> order) → Option<T> -
Available on Iterable<
The largest element of this Iterable based onT> , provided by the ElementalOnIterable extensionorder
. -
maxLength(
int maxLength, {int priority(T a, T b)?}) → IList< T> -
If the list has more than
maxLength
elements, remove the last elements so it remains with onlymaxLength
elements. If the list hasmaxLength
or less elements, doesn't change anything. -
minimumBy(
Order< T> order) → Option<T> -
Available on Iterable<
The least element of this Iterable based onT> , provided by the ElementalOnIterable extensionorder
. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notElem(
T element) → bool -
Available on Iterable<
Check ifT> , provided by the ElementalOnIterable extensionelement
is not contained inside this Iterable. -
partition(
bool test(T t)) → (Iterable< T> , Iterable<T> ) -
Available on Iterable<
Return a record containing the values of this Iterable for whichT> , provided by the ElementalOnIterable extensiontest
isfalse
in the first element, and the values for which it istrue
in the second element. -
prepend(
T element) → Iterable< T> -
Available on Iterable<
InsertT> , provided by the ElementalOnIterable extensionelement
at the beginning of the Iterable. -
prependAll(
Iterable< T> other) → Iterable<T> -
Available on Iterable<
Insert all the elements insideT> , provided by the ElementalOnIterable extensionother
at the beginning of the Iterable. -
process(
{bool test(IList< T> list, int index, T item)?, required Iterable<T> ? convert(IList<T> list, int index, T item)}) → IList<T> - Allows for complex processing of a list.
-
put(
int index, T value) → IList< T> -
This is the equivalent to
void operator []=(int index, T value);
for the IList. Sets the value at the givenindex
in the list tovalue
or throws a RangeError ifindex
is out of bounds. -
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.
override
-
remove(
T item) → IList< T> -
Removes the first occurrence of
item
from this IList. -
removeAll(
Iterable< T?> items) → IList<T> -
Removes all occurrences of all
items
from this list. Same as calling removeMany for each item initems
. -
removeAt(
int index, [Output< T> ? removedItem]) → IList<T> -
Removes the object at position
index
from this list. -
removeDuplicates(
) → IList< T> - Removes duplicates (but keeps items which appear only once, plus the first time other items appear).
-
removeLast(
[Output< T> ? removedItem]) → IList<T> -
Removes the last object from this list.
This method reduces the length of
this
by one. -
removeMany(
T item) → IList< T> -
Removes all occurrences of
item
from this list. -
removeNulls(
) → IList< T> - Removes all nulls from this list.
-
removeNullsAndDuplicates(
) → IList< T> - Removes duplicates (but keeps items which appear only once, plus the first time other items appear).
-
removeRange(
int start, int end) → IList< T> -
Removes the objects in the range
start
inclusive toend
exclusive. -
removeWhere(
Predicate< T> test) → IList<T> -
Removes all objects from this list that satisfy
test
. -
replace(
int index, T value) → IList< T> -
This is the equivalent to
void operator []=(int index, T value);
for the IList. Sets the value at the givenindex
in the list tovalue
or throws a RangeError ifindex
is out of bounds. -
replaceAll(
{required T from, required T to}) → IList< T> -
Finds all occurrences of
from
, and replace them withto
. -
replaceAllWhere(
Predicate< T> test, T to) → IList<T> -
Finds all items that satisfy the provided
test
, and replace it withto
. -
replaceBy(
int index, T transform(T item)) → IList< T> -
Returns a new IList, replacing the object at position
index
with the result of calling the functiontransform
. This function gets the previous object at positionindex
as a parameter. -
replaceFirst(
{required T from, required T to}) → IList< T> -
Finds the first occurrence of
from
, and replace it withto
. -
replaceFirstWhere(
bool test(T item), T replacement(T? item), {bool addIfNotFound = false}) → IList< T> -
Finds the first item that satisfies the provided
test
, and replace it with the result ofreplacement
. -
replaceRange(
int start, int end, Iterable< T> replacement) → IList<T> -
Removes the objects in the range
start
inclusive toend
exclusive and inserts the contents ofreplacement
in its place. -
restrict(
T? item, {required T orElse}) → T -
Available on Iterable<
Restricts some item to one of those present in this iterable.T> , provided by the FicIterableExtension extension -
retainWhere(
Predicate< T> test) → IList<T> -
Removes all objects from this list that fail to satisfy
test
. -
same(
IList< T> ? other) → bool -
Will return
true
only if the lists internals are the same instances (comparing by identity). This will be fast even for very large lists, since it doesn't compare each item.override -
setAll(
int index, Iterable< T> iterable) → IList<T> -
Overwrites objects of
this
with the objects ofiterable
, starting at positionindex
in this list. -
setRange(
int start, int end, Iterable< T> iterable, [int skipCount = 0]) → IList<T> -
Copies the objects of
iterable
, skippingskipCount
objects first, into the rangestart
, inclusive, toend
, exclusive, of the list. -
shuffle(
[Random? random]) → IList< T> - Shuffles the elements of this list randomly.
-
singleOr(
T orElse) → T -
Checks if the list has only one element, and returns that element.
Return
null
if the list is empty or has more than one element. -
singleWhere(
Predicate< T> test, {T orElse()?}) → T -
Returns the single element that satisfies
test
.override -
skip(
int count) → Iterable< T> -
Returns an Iterable that provides all but the first
count
elements.override -
skipWhile(
bool test(T value)) → Iterable< T> -
Returns an Iterable that skips leading elements while
test
is satisfied.override -
sort(
[int compare(T a, T b)?]) → IList< T> -
Sorts this list according to the order specified by the
compare
function. -
sortBy(
Order< T> order) → List<T> -
Available on Iterable<
Sort this List based onT> , provided by the ElementalOnIterable extensionorder
(Order). -
sortedLike(
Iterable ordering) → List< T> -
Available on Iterable<
Returns a list, sorted according to the order specified by theT> , provided by the FicIterableExtension extensionordering
iterable. Items which don't appear inordering
will be included in the end, in their original order. Items ofordering
which are not found in the original list are ignored. -
sortedReversed(
[Comparator< T> ? compare]) → List<T> -
Available on Iterable<
Creates a reversed sorted list of the elements of the iterable.T> , provided by the FicIterableExtension extension -
sortLike(
Iterable< T> ordering) → IList<T> -
Sorts this list according to the order specified by the
ordering
iterable. Items which don't appear inordering
will be included in the end, in no particular order. -
sortOrdered(
[int compare(T a, T b)?]) → IList< T> -
Sorts this list according to the order specified by the
compare
function. -
sortReversed(
[int compare(T a, T b)?]) → IList< T> - Sorts this list in reverse order in relation to the default sort method.
-
sortWith<
A> (A extract(T t), Order< A> order) → List<T> -
Available on Iterable<
Sort this Iterable based onT> , provided by the ElementalOnIterable extensionorder
of an object of typeA
extracted fromT
usingextract
. -
sortWithDate(
DateTime getDate(T instance)) → List< T> -
Available on Iterable<
Sort this Iterable based on DateTime extracted from typeT> , provided by the ElementalOnIterable extensionT
usinggetDate
. -
span(
bool test(T t)) → (Iterable< T> , Iterable<T> ) -
Available on Iterable<
Return a record where first element is longest prefix (possibly empty) of this Iterable with elements that satisfyT> , provided by the ElementalOnIterable extensiontest
and second element is the remainder of the Iterable. -
span(
Predicate< T> p) → Tuple2<Iterable< T> , Iterable<T> > - Split list based on predicate p. (takeWhile p, dropWhile p)
-
splitAt(
int index) → Tuple2< Iterable< T> , Iterable<T> > - Split the List at specified index
-
splitAt(
int n) → (Iterable< T> , Iterable<T> ) -
Available on Iterable<
Return a record where first element is an Iterable with the firstT> , provided by the ElementalOnIterable extensionn
elements of this Iterable, and the second element contains the rest of the Iterable. -
sublist(
int start, [int? end]) → IList< T> -
Returns a new list containing the elements between
start
andend
. -
sumBy<
N extends num> (N mapper(T element)) → N -
Available on Iterable<
The sum of the values returned by theT> , provided by the FicIterableExtension extensionmapper
function. -
tails(
) → Iterable< Iterable< T> > -
take(
int count) → Iterable< T> -
Returns an Iterable of the
count
first elements of this iterable.override -
takeWhile(
bool test(T value)) → Iterable< T> -
Returns an Iterable of the leading elements satisfying
test
.override -
takeWhileLeft(
bool test(T t)) → Iterable< T> -
Available on Iterable<
Extract all elements starting from the first as long asT> , provided by the ElementalOnIterable extensiontest
returnstrue
. -
toggle(
T element) → IList< T> - Removes the first instance of the element, if it exists in the list. Otherwise, adds it to the list.
-
toIList(
[ConfigList? config]) → IList< T> -
Available on Iterable<
Creates an immutable list (IList) from the iterable.T> , provided by the FicIterableExtension extension -
toISet(
[ConfigSet? config]) → ISet< T> -
Available on Iterable<
Creates an immutable set (ISet) from the iterable.T> , provided by the FicIterableExtension extension -
toJson(
Object? toJsonT(T)) → Object - Converts to JSon. Json serialization support for json_serializable with @JsonSerializable.
-
toList(
{bool growable = true}) → List< T> -
Creates a List containing the elements of this IList.
override
-
toSet(
) → Set< T> -
Creates a Set containing the same elements as this IList.
override
-
toString(
[bool? prettyPrint]) → String -
Returns a string representation of (some of) the elements of
this
.override -
unorderedEqualItems(
covariant Iterable? other) → bool -
Will return
true
only if the IList and the iterable items have the same number of elements, and the elements of the IList can be paired with the elements of the iterable, so that each pair is equal. This may be slow for very large lists, since it compares each item, one by one. -
unzip(
) → Tuple2< Iterable< U> , Iterable<V> > -
Available on Iterable<
Iterable Tuple2 as IterableTuple2< , provided by the FICZipExtension extensionU, V> > -
updateById(
Iterable< T> newItems, dynamic id(T item)) → List<T> -
Available on Iterable<
Returns a new list whereT> , provided by the FicIterableExtension extensionnewItems
are added or updated, by theirid
(and theid
is a function of the item), like so: -
updateById(
Iterable< T> newItems, dynamic id(T item)) → IList<T> -
Returns a new list where
newItems
are added or updated, by theirid
(and theid
is a function of the item), like so: -
where(
Predicate< T> test) → Iterable<T> -
Returns an Iterable with all elements that satisfy the predicate
test
.override -
whereMoveToTheEnd(
bool test(T item)) → IList< T> -
Moves all items that satisfy the provided
test
to the end of the list. Keeps the relative order of the moved items. -
whereMoveToTheStart(
bool test(T item)) → IList< T> -
Moves all items that satisfy the provided
test
to the start of the list. Keeps the relative order of the moved items. -
whereNoDuplicates(
{dynamic by(T item)?, bool removeNulls = false}) → Iterable< T> -
Available on Iterable<
Removes all duplicates, leaving only the distinct items. Optionally, you can provide anT> , provided by the FicIterableExtension extensionby
function to compare the items. -
whereNot(
Predicate< T> test) → Iterable<T> -
Returns an Iterable with all elements that doest NOT satisfy the predicate
test
. -
whereType<
E> () → Iterable< E> -
Returns an Iterable with all elements that have type
E
.override -
withConfig(
ConfigList config) → IList< T> -
Creates a new list with the given
config
. -
withConfigFrom(
IList< T> other) → IList<T> -
Returns a new list with the contents of the present IList,
but the config of
other
. -
zip<
B> (Iterable< B> iterable) → Iterable<(T, B)> -
Available on Iterable<
T> , provided by the ElementalOnIterable extensionzip
is used to join elements at the same index from two different Iterable into one Iterable of a record. -
zip(
Iterable< T> otherIterable) → Iterable<Tuple2< T, T> > - Aggregate two sources trimming by the shortest source
-
zipAll<
U> (Iterable< U> otherIterable, {T currentFill(int index)?, U otherFill(int index)?}) → Iterable<Tuple2< T?, U?> > -
Aggregate two sources based on the longest source.
Missing elements can be completed by passing a
currentFill
andotherFill
methods or will be at null by default -
zipWith<
B, C> (C combine(T t, B b), Iterable< B> iterable) → Iterable<C> -
Available on Iterable<
Join elements at the same index from two different Iterable into one Iterable containing the result of callingT> , provided by the ElementalOnIterable extensioncombine
on each element pair. -
zipWithIndex(
) → Iterable< Tuple2< int, T> > - Aggregate each element with corresponding index
Operators
-
operator +(
Iterable< T> other) → IList<T> -
Returns the concatenation of this list and
other
. Returns a new list containing the elements of this list followed by the elements ofother
. -
operator ==(
Object other) → bool -
If isDeepEquals configuration is
true
: Will returntrue
only if the list items are equal (and in the same order), and the list configurations are equal. This may be slow for very large lists, since it compares each item, one by one.If isDeepEquals configuration is
false
: Will returntrue
only if the lists internals are the same instances (comparing by identity). This will be fast even for very large lists, since it doesn't compare each item.override -
operator [](
int index) → T -
Returns the object at the given
index
in the list or throws a RangeError ifindex
is out of bounds.
Static Properties
- defaultConfig ↔ ConfigList
-
Global configuration that specifies if, by default, the ILists
use equality or identity for their operator ==.
By default
isDeepEquals: true
(lists are compared by equality) andcacheHashCode = true
.getter/setter pair - flushFactor ↔ int
-
Indicates the number of operations an IList may perform
before it is eligible for auto-flush. Must be larger than
0
.getter/setter pair
Static Methods
-
iterate<
U> (U base, int count, Op< U> op) → IList<U> - Apply Op on previous state of base and return all results
-
iterateWhile<
U> (U base, Predicate< U> test, Op<U> op) → IList<U> - Apply Op on previous state of base while predicate pass then return all results
-
orNull<
T> (Iterable< T> ? iterable, [ConfigList? config]) → IList<T> ? -
If Iterable is
null
, returnnull
. -
resetAllConfigurations(
) → void -
See also: ImmutableCollection, ImmutableCollection.lockConfig,
ImmutableCollection.isConfigLocked,flushFactor, defaultConfig
override
-
tabulate<
U> (int count, U on(int at)) → Iterable< U> -
tabulate2<
U> (int count0, int count1, U on(int at0, int at1)) → Iterable< Iterable< U> > -
tabulate3<
U> (int count0, int count1, int count2, U on(int at0, int at1, int at2)) → Iterable< Iterable< Iterable< >U> > -
tabulate4<
U> (int count0, int count1, int count2, int count3, U on(int at0, int at1, int at2, int at3)) → Iterable< Iterable< Iterable< >Iterable< >U> > -
tabulate5<
U> (int count0, int count1, int count2, int count3, int count4, U on(int at0, int at1, int at2, int at3, int at4)) → Iterable< Iterable< Iterable< >Iterable< >Iterable< >U> >