mirror of https://github.com/01-edu/public.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jrosendo
53af9f2ecb
|
2 years ago | |
---|---|---|
.. | ||
README.md | 2 years ago |
README.md
Data Structures
Instructions
In this exercise you will work with the following data structures: List, Set, and Map.
Declare and initialize following variables:
listNum
of typeList<int>
containing a list of integers (list length >= 5);listObj
of typeList<Object>
containing a list of items of different types (list length >= 4);listStr
of typeList<String>
containing a list of strings (list length >= 3);listList
of typeList<List<Object>>
containing a list of lists containinglistNum
,listObj
,listStr
;setStr
of typeSet<String>
containing at least 3 items;mapStr
of typeMap<String, int>
containing at least 3 pairs;
Usage
List
List is an array of elements. In dart lists are initialized as following:
var listNum1 = [1, 2, 3];
// or ...
List<int> listNum2 = [1, 2, 3];
Set
Set is an unordered collection of unique items. Sets are created as follows:
var set1 = {'Germany', 'Kazakhstan', 'France', 'England'};
// or ...
Set<String> set2 = {'Germany', 'Kazakhstan', 'France', 'England'};
Map
Map is a key-value data structure. Maps are created as:
var mapRadius = {
'Earth': 6378.1,
'Jupiter': 71492,
'Moon': 1738.1,
};
// or ...
Map<String, double> mapRadius = {
'Earth': 6378.1,
'Jupiter': 71492,
'Moon': 1738.1,
};
- Note: main is not needed!