首页 > 建站教程 > dart >  Dart编程实例 - 从HashMap删除值正文

Dart编程实例 - 从HashMap删除值

Dart编程实例 - 从HashMap删除值

import 'dart:collection';

main() {

   var accounts = new HashMap();

   accounts['dept'] = 'HR';

   accounts['name'] = 'Tom';

   accounts['email'] = 'tom@xyz.com';

   print('Map after adding  entries :${accounts}');

   accounts.remove('dept');

   print('Map after removing  entry :${accounts}');  

   accounts.clear();

   print('Map after clearing entries :${accounts}');

}