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

Side by Side Diff: lib/src/util/iterable_set.dart

Issue 1887853002: Add a LiveSuite class. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Code review changes 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
« no previous file with comments | « lib/src/runner/live_suite_controller.dart ('k') | pubspec.yaml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
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.
4
5 import 'dart:collection';
6
7 import 'package:collection/collection.dart';
8
9 /// An unmodifiable [Set] view backed by an arbitrary [Iterable].
10 ///
11 /// Note that contrary to most APIs that take iterables, this does not convert
12 /// its argument to another collection before use. This means that if it's
13 /// lazily-generated, that generation will happen for every operation.
14 ///
15 /// Note also that set operations that are usually expected to be `O(1)` or
16 /// `O(log(n))`, such as [contains], may be `O(n)` for many underlying iterable
17 /// types. As such, this should only be used for small iterables.
18 class IterableSet<E> extends SetMixin<E> with UnmodifiableSetMixin<E> {
19 /// The base iterable that set operations forward to.
20 final Iterable<E> _base;
21
22 int get length => _base.length;
23
24 Iterator<E> get iterator => _base.iterator;
25
26 /// Creates a [Set] view of [base].
27 IterableSet(this._base);
28
29 bool contains(Object element) => _base.contains(element);
30
31 E lookup(Object needle) =>
32 _base.firstWhere((element) => element == needle, orElse: () => null);
33
34 Set<E> toSet() => _base.toSet();
35 }
OLDNEW
« no previous file with comments | « lib/src/runner/live_suite_controller.dart ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698