Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Side by Side Diff: src/tests/site/code/collections.dart

Issue 83663005: added front page samples to testing, plus a couple of tweaks to front page and code lab (Closed) Base URL: https://github.com/dart-lang/dartlang.org.git@master
Patch Set: put front page code snippets under testing, minor tweaks, fixed carousel height problem Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 void main() {
2 Map famousDuos = { 'Han Solo': 'Chewbacca', // Map literal.
3 'Bonnie': 'Clyde',
4 'Laurel': 'Hardy' };
5 List myFriends = [ 'Seth', 'Kathy', 'Shailen' ]; // List literal.
6
7 // Create lists and maps from Iterable objects.
8 List shuffledSidekicks = new List.from(famousDuos.values)..shuffle();
9 Map mixedDuos = new Map.fromIterables(famousDuos.keys, shuffledSidekicks);
10
11 // Iteration.
12 mixedDuos.forEach((k, v) { print('$k, $v'); });
13
14 // Some lists, maps, and sets are growable.
15 Set setOfMyFriends = new Set.from(myFriends);
16 Set famousPeople = new Set.from(famousDuos.values);
17 famousPeople.addAll(famousDuos.keys);
18
19 // Rich set of functionality for collections.
20 print(famousPeople.intersection(setOfMyFriends).isEmpty);
21 print(famousPeople.union(setOfMyFriends).length);
22 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698