| OLD | NEW |
| 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 concatentation 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. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 */ | 21 */ |
| 22 List nullIfEmpty(List list) { | 22 List nullIfEmpty(List list) { |
| 23 if (list == null) { | 23 if (list == null) { |
| 24 return null; | 24 return null; |
| 25 } | 25 } |
| 26 if (list.isEmpty) { | 26 if (list.isEmpty) { |
| 27 return null; | 27 return null; |
| 28 } | 28 } |
| 29 return list; | 29 return list; |
| 30 } | 30 } |
| 31 |
| 32 /// A pair of values. |
| 33 class Pair<E, F> { |
| 34 final E first; |
| 35 final F last; |
| 36 |
| 37 Pair(this.first, this.last); |
| 38 |
| 39 int get hashCode => first.hashCode ^ last.hashCode; |
| 40 |
| 41 bool operator ==(other) { |
| 42 if (other is! Pair) return false; |
| 43 return other.first == first && other.last == last; |
| 44 } |
| 45 |
| 46 String toString() => '($first, $last)'; |
| 47 } |
| OLD | NEW |