Vector<T extends Comparable> class

Mixed-in types

Constructors

Vector(List<T> _data)
Creates a Vector containing the elements of the provided list.
const

Properties

first → T
The first element.
no setterinherited
hashCode int
The hash code for this object.
no setteroverride
isEmpty bool
Whether this collection has no elements.
no setterinherited
isNotEmpty bool
Whether this collection has at least one element.
no setterinherited
iterator Iterator<T>
Exposes the iterator from the underlying list. This allows the Vector to be used in standard Dart for (var x in vec) loops.
no setteroverride
last → T
The last element.
no setterinherited
length int
Returns the number of elements in the vector (O(1) time).
no setteroverride
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.
no setterinherited

Methods

any(bool test(T element)) bool
Checks whether any element of this iterable satisfies test.
inherited
assign(int count, T value) → void
Replaces the contents of the vector with count copies of value.
at(int index) → T
Retrieves the element at the specified index.
back() → T
Retrieves the last element of the vector.
cast<R>() Iterable<R>
A view of this iterable as an iterable of R instances.
inherited
clear() → void
Removes all elements from the vector.
compareTo(Vector<T> other) int
Lexicographically compares this vector to other.
contains(Object? element) bool
Whether the collection contains an element equal to element.
override
elementAt(int index) → T
Returns the indexth element.
inherited
empty() bool
every(bool test(T element)) bool
Checks whether every element of this iterable satisfies test.
inherited
expand<T>(Iterable<T> toElements(T element)) Iterable<T>
Expands each element of this Iterable into zero or more elements.
inherited
firstWhere(bool test(T element), {T orElse()?}) → T
The first element that satisfies the given predicate test.
inherited
fold<T>(T initialValue, T combine(T previousValue, T element)) → T
Reduces a collection to a single value by iteratively combining each element of the collection with an existing value
inherited
followedBy(Iterable<T> other) Iterable<T>
Creates the lazy concatenation of this iterable and other.
inherited
forEach(void action(T element)) → void
Invokes action on each element of this iterable in iteration order.
inherited
front() → T
Retrieves the first element of the vector.
indexOf(T element) int
insert(int index, T value) → void
Inserts value at the specified index.
insertAll(int index, Iterable<T> iterable) → void
Inserts a range of elements from iterable starting at index.
join([String separator = ""]) String
Converts each element to a String and concatenates the strings.
inherited
lastWhere(bool test(T element), {T orElse()?}) → T
The last element that satisfies the given predicate test.
inherited
map<T>(T toElement(T 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
popBack() → void
Removes the last element from the vector.
pushBack(T value) → void
Adds an element to the end of the vector.
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 element) → void
removeAt(int index) → void
removeLast() → void
removeRange(int start, int end) → void
removeWhere(bool test(T element)) → void
resize(int count, T fill) → void
Resizes the vector to contain count elements. If the current size is greater than count, the container is reduced to its first count elements. If the current size is less than count, the container is expanded by inserting copies of fill.
retainWhere(bool test(T element)) → void
reverse() → void
shuffle() → void
singleWhere(bool test(T element), {T orElse()?}) → T
The single element that satisfies test.
inherited
size() int
skip(int count) Iterable<T>
Creates an Iterable that provides all but the first count elements.
inherited
skipWhile(bool test(T value)) Iterable<T>
Creates an Iterable that skips leading elements while test is satisfied.
inherited
sort() → void
swap(Vector<T> other) → void
Exchanges the contents of this vector with those of other.
take(int count) Iterable<T>
Creates a lazy iterable of the count first elements of this iterable.
inherited
takeWhile(bool test(T value)) Iterable<T>
Creates a lazy iterable of the leading elements satisfying test.
inherited
toList({bool growable = true}) List<T>
Creates a List containing the elements of this Iterable.
inherited
toSet() Set<T>
Creates a Set containing the same elements as this iterable.
inherited
toString() String
A string representation of this object.
override
where(bool test(T element)) Iterable<T>
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 *(int times) Vector<T>
You can overload the multiplication operator to take an int and return a new Vector repeated n times (similar to Python's 1, 2 * 3 == 1, 2, 1, 2, 1, 2).
operator +(Vector<T> other) Vector<T>
Concatenates two vectors. Guarantees memory safety by creating a new vector with the combined elements.
operator -(Vector<T> other) Vector<T>
Removes all occurrences of elements found in other
operator <(Vector<T> other) bool
operator <=(Vector<T> other) bool
operator ==(Object other) bool
The equality operator.
override
operator >(Vector<T> other) bool
operator >=(Vector<T> other) bool
operator [](int index) → T
Retrieves the element at the specified index.
operator []=(int index, T value) → void
Sets the element at the specified index to value.
operator ~() List<T>
Converts the vector to a standard Dart list.