| Index: pkg/analysis_server/lib/src/collections.dart
|
| diff --git a/pkg/analysis_server/lib/src/collections.dart b/pkg/analysis_server/lib/src/collections.dart
|
| index f85bc975cffdbe72a7cf396956b40879ec5cedc6..e49a0fe7f22f00cbd7557f38264eb6eda5c982ba 100644
|
| --- a/pkg/analysis_server/lib/src/collections.dart
|
| +++ b/pkg/analysis_server/lib/src/collections.dart
|
| @@ -16,3 +16,17 @@ Iterable concat(Iterable<Iterable> iterables) => iterables.expand((x) => x);
|
| * Returns the concatentation of the input iterables as a [List].
|
| */
|
| List concatToList(Iterable<Iterable> iterables) => concat(iterables).toList();
|
| +
|
| +
|
| +/**
|
| + * Returns the given [list] if it is not empty, or `null` otherwise.
|
| + */
|
| +List nullIfEmpty(List list) {
|
| + if (list == null) {
|
| + return null;
|
| + }
|
| + if (list.isEmpty) {
|
| + return null;
|
| + }
|
| + return list;
|
| +}
|
|
|