Spec-Zone.ru › Dart 1

dart:collection

Добавить абстрактный метод

bool add(E element)

Добавляет value в множество.

Возвращает true если value (или значение, ему равное) ещё не было в множестве. В противном случае возвращает false и множество не изменяется.

Пример:

var set = new Set();
var time1 = new DateTime.fromMillisecondsSinceEpoch(0);
var time2 = new DateTime.fromMillisecondsSinceEpoch(0);
// time1 and time2 are equal, but not identical.
Expect.isTrue(time1 == time2);
Expect.isFalse(identical(time1, time2));
set.add(time1);  // => true.
// A value equal to time2 exists already in the set, and the call to
// add doesn't change the set.
set.add(time2);  // => false.
Expect.isTrue(set.length == 1);
Expect.isTrue(identical(time1, set.first));

Исходный код

bool add(E element);

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dartlang.org/stable/1.24.3/dart-collection/SetMixin/add.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API