d_util
library
Classes
-
ArgumentsError
-
-
Array<E>
-
-
BoolList
-
A space-efficient list of boolean values.
-
CanonicalizedMap<C, K, V>
-
A map whose keys are converted to canonical values of type
C
.
-
CaseInsensitiveEquality
-
String equality that's insensitive to differences in ASCII case.
-
CComparator<T>
-
-
CComparator2<T>
-
-
CombinedIterableView<T>
-
A view of several iterables combined sequentially into a single iterable.
-
CombinedListView<T>
-
A view of several lists combined into a single list.
-
CombinedMapView<K, V>
-
Returns a new map that represents maps flattened into a single map.
-
DeepCollectionEquality
-
Deep equality on collections.
-
DefaultEquality<E>
-
Equality of objects that compares only the natural equality of the objects.
-
DelegatingIterable<E>
-
An Iterable that delegates all operations to a base iterable.
-
DelegatingList<E>
-
A List that delegates all operations to a base list.
-
DelegatingMap<K, V>
-
A Map that delegates all operations to a base map.
-
DelegatingQueue<E>
-
A Queue that delegates all operations to a base queue.
-
DelegatingSet<E>
-
A Set that delegates all operations to a base set.
-
Double
-
-
Equality<E>
-
A generic equality relation on objects.
-
EqualityBy<E, F>
-
Equality of objects based on derived values.
-
EqualityMap<K, V>
-
A Map whose key equality is determined by an Equality object.
-
EqualitySet<E>
-
A Set whose key equality is determined by an Equality object.
-
Exception
-
-
FastSelect
-
一种快速的选择算法,来源于快速排序
移植自 https://github.com/mourner/quickselect
重新排列项目,使Array中的所有在
left, k
的数据都是最小的。第K个元素的索引为left, right
中的 (k - left + 1)。
array :要部分排序的数组(就地)
k :用于部分排序的中间索引(如上定义)
left :要排序的范围的左索引(默认 0 )
right :右索引(默认情况下是数组的最后一个索引)
compareFn :比较函数
example
var arr = 65, 28, 59, 33, 21, 56, 22, 95, 50, 12, 90, 53, 28, 77, 39
;
quickselect(arr, 8);
arr is 39, 28, 28, 33, 21, 12, 22, 50, 53, 56, 59, 65, 90, 77, 95
^^ middle index
-
HeapPriorityQueue<E>
-
Heap based priority queue.
-
IdentityEquality<E>
-
Equality of objects that compares only the identity of the objects.
-
IllegalArgumentException
-
-
IllegalStatusError
-
-
Integer
-
-
IterableEquality<E>
-
Equality on iterables.
-
IterableZip<T>
-
Iterable that iterates over lists of values from other iterables.
-
ListEquality<E>
-
Equality on lists.
-
ListIterator<T>
-
-
ListSlice<E>
-
A list view of a range of another list.
-
MapEquality<K, V>
-
Equality on maps.
-
MapKeySet<E>
-
An unmodifiable Set view of the keys of a Map.
-
MapValueSet<K, V>
-
Creates a modifiable Set view of the values of a Map.
-
Math
-
-
MultiEquality<E>
-
Combines several equalities into a single equality.
-
NonGrowableListMixin<E>
-
Mixin class that implements a throwing version of all list operations that
change the List's length.
-
NonGrowableListView<E>
-
A fixed-length list.
-
OutOfRangeError
-
-
Pair<F, S>
-
-
PriorityQueue<E>
-
A priority queue is a priority based work-list of elements.
-
QueueList<E>
-
A class that efficiently implements both Queue and List.
-
SetEquality<E>
-
Equality of sets.
-
Stack<E>
-
-
TypeMatchError
-
-
UnionSet<E>
-
A single set that provides a view of the union over a set of sets.
-
UnionSetController<E>
-
A controller that exposes a view of the union of a collection of sets.
-
UniqueList<E>
-
它在保证唯一性的同时额外记录了索引信息
-
UnmodifiableListView<E>
-
An unmodifiable List view of another List.
-
UnmodifiableMapMixin<K, V>
-
Mixin class that implements a throwing version of all map operations that
change the Map.
-
UnmodifiableMapView<K, V>
-
View of a Map that disallow modifying the map.
-
UnmodifiableSetMixin<E>
-
Mixin class that implements a throwing version of all set operations that
change the Set.
-
UnmodifiableSetView<E>
-
An unmodifiable set.
-
UnorderedIterableEquality<E>
-
Equality of the elements of two iterables without considering order.
-
UnSupportError
-
-
Uuid
-
uuid for Dart
Author: Yulian Kuncheff
Released under MIT License.
-
UuidValue
-
Functions
-
binarySearch<E>(List<E> sortedList, E value, {int compare(E, E)?})
→ int
-
Returns a position of the
value
in sortedList
, if it is there.
-
checkArgs(bool value, [String? msg])
→ void
-
-
checkRef(dynamic a, dynamic b, [String? msg])
→ void
-
检查给定的两个数据的引用地址是否一样
如果一样则抛出异常
-
compareAsciiLowerCase(String a, String b)
→ int
-
Compares
a
and b
lexically, converting ASCII letters to lower case.
-
compareAsciiLowerCaseNatural(String a, String b)
→ int
-
Compares strings
a
and b
according to lower-case
natural sort ordering.
-
compareAsciiUpperCase(String a, String b)
→ int
-
Compares
a
and b
lexically, converting ASCII letters to upper case.
-
compareAsciiUpperCaseNatural(String a, String b)
→ int
-
Compares strings
a
and b
according to upper-case
natural sort ordering.
-
compareNatural(String a, String b)
→ int
-
Compares strings
a
and b
according to natural sort ordering.
-
equalsIgnoreAsciiCase(String a, String b)
→ bool
-
Checks if strings
a
and b
differ only on the case of ASCII letters.
-
groupBy<S, T>(Iterable<S> values, T key(S))
→ Map<T, List<S>>
-
Groups the elements in
values
by the value returned by key
.
-
hashIgnoreAsciiCase(String string)
→ int
-
Hash code for a string which is compatible with equalsIgnoreAsciiCase.
-
insertionSort<E>(List<E> elements, {int compare(E, E)?, int start = 0, int? end})
→ void
-
Sort a list between
start
(inclusive) and end
(exclusive) using
insertion sort.
-
jsAnd(dynamic a, dynamic b)
→ dynamic
-
模拟javaScript a&& b的返回值
-
jsBool2Int(bool a)
→ int
-
模拟js 三目运算符返回结果
-
jsBoolAnd(dynamic a, dynamic b)
→ bool
-
模拟JavaScript a&&b 的bool 返回值
-
jsBoolOr(num a, num b)
→ bool
-
模拟JavaScript a||b 的bool 返回值
-
jsOr(dynamic a, dynamic b)
→ dynamic
-
模拟javaScript a || b的返回值
-
jsTrue(dynamic obj)
→ bool
-
模拟js 对象为真判断
判断一个数是否为真(0,"",null为假)
-
lastBy<S, T>(Iterable<S> values, T key(S))
→ Map<T, S>
-
Associates the elements in
values
by the value returned by key
.
-
lowerBound<E>(List<E> sortedList, E value, {int compare(E, E)?})
→ int
-
Returns the first position in
sortedList
that does not compare less than
value
.
-
mapMap<K1, V1, K2, V2>(Map<K1, V1> map, {K2 key(K1, V1)?, V2 value(K1, V1)?})
→ Map<K2, V2>
-
Creates a new map from
map
with new keys and values.
-
maxBy<S, T>(Iterable<S> values, T orderBy(S), {int compare(T, T)?})
→ S?
-
Returns the element of
values
for which orderBy
returns the maximum
value.
-
mergeMaps<K, V>(Map<K, V> map1, Map<K, V> map2, {V value(V, V)?})
→ Map<K, V>
-
Returns a new map with all key/value pairs in both
map1
and map2
.
-
mergeSort<E>(List<E> elements, {int start = 0, int? end, int compare(E, E)?})
→ void
-
Sorts a list between
start
(inclusive) and end
(exclusive) using the
merge sort algorithm.
-
minBy<S, T>(Iterable<S> values, T orderBy(S), {int compare(T, T)?})
→ S?
-
Returns the element of
values
for which orderBy
returns the minimum
value.
-
randomId()
→ String
-
-
reverse<E>(List<E> elements, [int start = 0, int? end])
→ void
-
Reverses a list, or a part of a list, in-place.
-
shuffle(List elements, [int start = 0, int? end, Random? random])
→ void
-
Shuffles a list randomly.
-
stronglyConnectedComponents<T>(Map<T, Iterable<T>> graph)
→ List<Set<T>>
-
Returns the strongly connected components of
graph
, in topological
order.
-
transitiveClosure<T>(Map<T, Iterable<T>> graph)
→ Map<T, Set<T>>
-
Returns the transitive closure of
graph
.
Typedefs
-
CompareFun<E>
= int Function(E a, E b)
-
-
CompareFun2<E>
= Comparable Function(E a)
-
-
EachFun<E>
= void Function(E data, int index)
-
-
Fun1<A>
= void Function(A a)
-
-
Fun2<A, B>
= B Function(A a)
-
-
Fun3<A, B, C>
= C Function(A a, B b)
-
-
Fun4<A, B, C, D>
= D Function(A a, B b, C c)
-
-
Fun5<A, B, C, D, E>
= E Function(A a, B b, C c, D d)
-
-
VoidFun1<A>
= void Function(A a)
-
-
VoidFun2<A, B>
= void Function(A a, B b)
-
-
VoidFun3<A, B, C>
= void Function(A a, B b, C c)
-
-
VoidFun4<A, B, C, D>
= void Function(A a, B b, C c, D d)
-
-
VoidFun5<A, B, C, D, E>
= void Function(A a, B b, C c, D d, E e)
-