首页 > 建站教程 > dart >  Dart编程实例 - 集合 Set正文

Dart编程实例 - 集合 Set

Dart编程实例 - 集合 Set

void main() {

   Set numberSet = new  Set();

   numberSet.add(100);

   numberSet.add(20);

   numberSet.add(5);

   numberSet.add(60);

   numberSet.add(70);

   print("Default implementation :${numberSet.runtimeType}");  

   // all elements are retrieved in the order in which they are inserted

   for(var no in numberSet) {

      print(no);

   }

}