OLD | NEW |
| (Empty) |
1 // Copyright (c) 2013, 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 part of dart.collection; | |
6 | |
7 /** | |
8 * An unmodifiable [List] view of another List. | |
9 * | |
10 * The source of the elements may be a [List] or any [Iterable] with | |
11 * efficient [Iterable.length] and [Iterable.elementAt]. | |
12 */ | |
13 class UnmodifiableListView<E> extends UnmodifiableListBase<E> { | |
14 final Iterable<E> _source; | |
15 | |
16 /** | |
17 * Creates an unmodifiable list backed by [source]. | |
18 * | |
19 * The [source] of the elements may be a [List] or any [Iterable] with | |
20 * efficient [Iterable.length] and [Iterable.elementAt]. | |
21 */ | |
22 UnmodifiableListView(Iterable<E> source) : _source = source; | |
23 int get length => _source.length; | |
24 E operator[](int index) => _source.elementAt(index); | |
25 } | |
OLD | NEW |