dart-sdk/benchmarks/SoundSplayTreeSieve/dart2/iterable.dart
Jonas Termansen 6f66f82625 [benchmark] Fork benchmarks for null safety and pin internal ones.
This change forks the benchmarks for the null safety feature where there
now is a null safe version at benchmarks/Foo/dart and a legacy Dart 2
version at benchmarks/Foo/dart2. This change allows benchmarks to be
migrated per go/dart-nnbd-benchmark-migration.

Additionally this change pins the internal benchmarks which have been
moved into their own repository and is now versioned along with the Dart
SDK.

The dart2 implementation will be benchmarked instead of the null safe
dart implementation as of this change. The null safe dart implementation
will be used when null safe benchmarking is turned on.

Change-Id: If039fd7100c960169f4161c1d98167aca0af2ded
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148440
Reviewed-by: Alexander Thomas <athom@google.com>
2020-06-02 12:53:24 +00:00

24 lines
913 B
Dart

/// Marker interface for [Iterable] subclasses that have an efficient
/// [length] implementation.
abstract class EfficientLengthIterable<T> extends Iterable<T> {
const EfficientLengthIterable();
/// Returns the number of elements in the iterable.
///
/// This is an efficient operation that doesn't require iterating through
/// the elements.
int get length;
}
/// Creates errors throw by [Iterable] when the element count is wrong.
abstract class IterableElementError {
/// Error thrown thrown by, e.g., [Iterable.first] when there is no result.
static StateError noElement() => StateError("No element");
/// Error thrown by, e.g., [Iterable.single] if there are too many results.
static StateError tooMany() => StateError("Too many elements");
/// Error thrown by, e.g., [List.setRange] if there are too few elements.
static StateError tooFew() => StateError("Too few elements");
}