Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Dart Programming - Generic Set

void main() { 
   Set <int>numberSet = new  Set<int>(); 
   numberSet.add(100); 
   numberSet.add(20); 
   numberSet.add(5); 
   numberSet.add(60);
   numberSet.add(70); 
   // numberSet.add("Tom"); 
   compilation error; 
   print("Default implementation  :${numberSet.runtimeType}");  
   for(var no in numberSet) { 
      print(no); 
   } 
}

Dart Programming - Generic List Example

void main() { 
   List <String> logTypes = new List <String>(); 
   logTypes.add(1); 
   logTypes.add("ERROR"); 
   logTypes.add("INFO"); 
   //iterating across list 
   for (String type in logTypes) { 
      print(type); 
   } 
} 

Dart Programming - Generic List

void main() { 
   List <String> logTypes = new List <String>(); 
   logTypes.add("WARNING"); 
   logTypes.add("ERROR"); 
   logTypes.add("INFO");  
   // iterating across list 
   for (String type in logTypes) { 
      print(type); 
   } 
}

Dart Programming - addLast()

import 'dart:collection'; 
void main() { 
   Queue numQ = new Queue(); 
   numQ.addAll([100,200,300]); 
   print("Printing Q.. ${numQ}");  
   numQ.addLast(400); 
   print("Printing Q.. ${numQ}"); 
} 

Dart Programming - addFirst()

import 'dart:collection'; 
void main() { 
   Queue numQ = new Queue(); 
   numQ.addAll([100,200,300]); 
   print("Printing Q.. ${numQ}");
   numQ.addFirst(400); 
   print("Printing Q.. ${numQ}"); 
} 

Dart Programming - Adding Multiple Values to a Queue

import 'dart:collection'; 
void main() { 
   Queue queue = new Queue(); 
   print("Default implementation ${queue.runtimeType}"); 
   queue.addAll([10,12,13,14]); 
   for(var no in queue){ 
      print(no); 
   } 
}

Dart Programming - Collection Queue

import 'dart:collection'; 
void main() { 
   Queue queue = new Queue(); 
   print("Default implementation ${queue.runtimeType}"); 
   queue.add(10); 
   queue.add(20); 
   queue.add(30); 
   queue.add(40); 
   for(var no in queue){ 
      print(no); 
   } 
}

Dart Programming - Collection Maps

void main() { 
  var details=new Map(); 
  details['Usrname']='admin'; 
  details['Password']='admin@123'; 
  print(details); 
} 

Dart Programming - Removing Values from a HashSet

import 'dart:collection'; 
void main() { 
   Set numberSet = new  HashSet(); 
   numberSet.addAll([100,200,300]); 
   print("Printing hashet.. ${numberSet}");  
   numberSet.remove(100); 
   print("Printing hashet.. ${numberSet}");  
   numberSet.clear(); 
   print("Printing hashet.. ${numberSet}"); 
} 

Dart Programming - Adding Multiple Values to a HashSet

import 'dart:collection'; 
void main() { 
   Set numberSet = new  HashSet(); 
   numberSet.addAll([100,200,300]); 
   print("Default implementation :${numberSet.runtimeType}"); 
   for(var no in numberSet){ 
      print(no); 
   } 
}

Previous 1 ... 4 5 6 7 8 9 10 ... 21 Next
Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.