Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(347)

Side by Side Diff: packages/charted/lib/core/utils/lists.dart

Issue 2989763002: Update charted to 0.4.8 and roll (Closed)
Patch Set: Removed Cutch from list of reviewers Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // 1 //
2 // Copyright 2014 Google Inc. All rights reserved. 2 // Copyright 2014 Google Inc. All rights reserved.
3 // 3 //
4 // Use of this source code is governed by a BSD-style 4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file or at 5 // license that can be found in the LICENSE file or at
6 // https://developers.google.com/open-source/licenses/bsd 6 // https://developers.google.com/open-source/licenses/bsd
7 // 7 //
8 8
9 part of charted.core.utils; 9 part of charted.core.utils;
10 10
11 /// Returns a sum of all values in the given list of values 11 /// Returns a sum of all values in the given list of values
12 num sum(List values) => values == null || values.isEmpty 12 num sum(List values) => values == null || values.isEmpty
13 ? 0 13 ? 0
14 : values.fold(0.0, (old, next) => old + next); 14 : values.fold(0.0, (old, next) => old + next);
15 15
16 /// Returns the smallest number in the given list of values 16 /// Returns the smallest number in the given list of values
17 num min(Iterable values) => values == null || values.isEmpty 17 num min(Iterable<num> values) => values == null || values.isEmpty
18 ? null 18 ? null
19 : values.fold(values.elementAt(0), math.min); 19 : values.fold(values.elementAt(0), (x, y) => math.min(x, y));
20 20
21 /// Returns the largest number in the given list of values 21 /// Returns the largest number in the given list of values
22 num max(Iterable values) => values == null || values.isEmpty 22 num max(Iterable<num> values) => values == null || values.isEmpty
23 ? null 23 ? null
24 : values.fold(values.elementAt(0), math.max); 24 : values.fold(values.elementAt(0), (x, y) => math.max(x, y));
25 25
26 /// Represents a constant pair of values 26 /// Represents a constant pair of values
27 class Pair<T1, T2> { 27 class Pair<T1, T2> {
28 final T1 first; 28 final T1 first;
29 final T2 last; 29 final T2 last;
30 30
31 const Pair(this.first, this.last); 31 const Pair(this.first, this.last);
32 32
33 bool operator ==(other) => 33 bool operator ==(other) =>
34 other is Pair && first == other.first && last == other.last; 34 other is Pair && first == other.first && last == other.last;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 : super(values); 103 : super(values);
104 104
105 static int _integerConversionFactor(num val) { 105 static int _integerConversionFactor(num val) {
106 int k = 1; 106 int k = 1;
107 while (val * k % 1 > 0) { 107 while (val * k % 1 > 0) {
108 k *= 10; 108 k *= 10;
109 } 109 }
110 return k; 110 return k;
111 } 111 }
112 } 112 }
OLDNEW
« no previous file with comments | « packages/charted/lib/core/text_metrics.dart ('k') | packages/charted/lib/locale/format/number_format.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698