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

Side by Side Diff: pkg/analysis_server/lib/src/collections.dart

Issue 1855643002: More strong mode changes to analysis_server (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Backout changes to options file Created 4 years, 8 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 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library collections; 5 library collections;
6 6
7 /** 7 /**
8 * Returns the concatentation of the input iterables. 8 * Returns the concatenation of the input [iterables].
9 * 9 *
10 * The returned iterable is a lazily-evaluated view on the input iterables. 10 * The returned iterable is a lazily-evaluated view on the input iterables.
11 */ 11 */
12 Iterable concat(Iterable<Iterable> iterables) => iterables.expand((x) => x); 12 Iterable/*<E>*/ concat/*<E>*/(Iterable<Iterable/*<E>*/ > iterables) =>
13 iterables.expand((x) => x);
13 14
14 /** 15 /**
15 * Returns the concatentation of the input iterables as a [List]. 16 * Returns the concatenation of the input [iterables] as a [List].
16 */ 17 */
17 List concatToList(Iterable<Iterable> iterables) => concat(iterables).toList(); 18 List/*<E>*/ concatToList/*<E>*/(Iterable<Iterable/*<E>*/ > iterables) =>
19 concat(iterables).toList();
18 20
19 /** 21 /**
20 * Returns the given [list] if it is not empty, or `null` otherwise. 22 * Returns the given [list] if it is not empty, or `null` otherwise.
21 */ 23 */
22 List nullIfEmpty(List list) { 24 List/*<E>*/ nullIfEmpty/*<E>*/(List/*<E>*/ list) {
23 if (list == null) { 25 if (list == null) {
24 return null; 26 return null;
25 } 27 }
26 if (list.isEmpty) { 28 if (list.isEmpty) {
27 return null; 29 return null;
28 } 30 }
29 return list; 31 return list;
30 } 32 }
31 33
32 /// A pair of values. 34 /// A pair of values.
33 class Pair<E, F> { 35 class Pair<E, F> {
34 final E first; 36 final E first;
35 final F last; 37 final F last;
36 38
37 Pair(this.first, this.last); 39 Pair(this.first, this.last);
38 40
39 int get hashCode => first.hashCode ^ last.hashCode; 41 int get hashCode => first.hashCode ^ last.hashCode;
40 42
41 bool operator ==(other) { 43 bool operator ==(other) {
42 if (other is! Pair) return false; 44 if (other is! Pair) return false;
43 return other.first == first && other.last == last; 45 return other.first == first && other.last == last;
44 } 46 }
45 47
46 String toString() => '($first, $last)'; 48 String toString() => '($first, $last)';
47 } 49 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/analysis_manager.dart ('k') | pkg/analysis_server/lib/src/server/driver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698