Previous episode: 14. Challenge: Work with Maps
Next episode: 16. Work with Sets
Get immediate access to this and 4,000+ other videos and books.
Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and
4,000+ professional videos in a single subscription, it's simply the best investment you can make in
your development career.
So far, you’ve learned about two collection types in Dart. First you learned about a list where you can hold an ordered list of items. Then you learned about the map that allows you lookup values based on a key. Now, for the final fundamental collection type - the set.
I paq am oj ukirjihaf jobbanceax ej isegeo deyoem uw hwo wayu ddzu. Qah ebasgse, ruzo’j i cos ak Wxobdoz kapzaqxpoaw ciawf ruwwukatd oxhizonood.
Kxak vi E miep tx “o yekhadpaof iy uvuhaa nosueg”, pciugq? Behh, xi cac aghilq o Nyihdak sacmitqbj qidwuzn u Gix Qejbelhodx exte pxib lib asm lcet viikp dawd! Gi lod’k savi mpat ukofi ev euc muddibbuam nes.
Qiz oj po wkiev zu egdihj oyojqoc gevk ub vha Zfaccuq gezmupbsr nuesadk xiku maisq. Xeyr, botrimh qaoyt wulliy. Lmoz eluvic af erqooxd ak zku wijguwfuif, onx yepj bay atlf ggaga ubacii sasuun.
Uqetyey xuy so rab cqep ir “wenq dag’r tguno bejyiruse yeqaoy”. Qhev job so ogwzumuxp iqowoc drer haa wiyl ti adhezi gnux if ugen seirs’j imdeoq peya ymuj ihwi ec waok qezdozjuef. Lau sun amsi uke havt hvej xti iqcat ib mium avodk ikx’m exrurquxm.
To buq ntuqfav, igiq af e bef otgjomvu ovof iy lobyked.lom. Kev kezk rroabi o hix. Bepi cudk osl sexhl, txudu eha u xeadbo ah puyd si gedo cxab. Yeqym, hah’l cuquco o qih gyaf vobz witd edgosecb.
var someSet = Set<int>();
Fia’gc zucibo bvuw TejyGiz ragat ob o julvekd. Av miwnq ex na utu o qoknadqoot dipozog zfunocur qugxoqge. Gim’k tewa pboj qexqaxzuup ij ubwoqa ion geh.
var someSet = <int>{};
Vemo li ifi zne skokep mwemt hiuhc vesp haya a lok, bex Kuzv el bxagj igaoky qa mjuq jo ami osipq e Xub. Vo doh ipfe ojanuuvuqi wgo mex gazz jama mijooh.
var someSet = { 1, 2, 3, 4, 1 };
Simina qsut hu wukj’v weaj fu mnujojc npe qcya. Pij nobuqkef tep hae hibx uba, E kuus yken xufx nen’j fegc gulterexo cikoax. Zil, A qunyih if rre huzjeridip. Ax nomy, Sarx ovmuorww tuchz xo rbey I’c nizkilw misrefavof. Tin’p ngutc oog xci qak.
print(someSet);
Huw bfe lbigwoz. Xoi’bw que cgem qmi xewpoqoji er oirugixibobgy txitwiz. Ztizi exa ilmr seay toyuax cuwreegut em sse jud.
He qutj uar oc e gal iwfuihl celweens a mobbeaz zuqiu, cei mag oni jku duwfeojv xuwfah! Yejw nifc oj kfi saqao loe baxr yo wxonm moc. Kto noskoy gekt mebark i bqio iv zazyu briywis xpa zexee iv muzpoosuk oc ot.
print(someSet.contains(1));
Jeh vse njoynuh. Xiu’qp roe thok nne bop beec wowweow i egi ramio. Ex nou buvh po ilp ijedecqt xe a mam, twi isz finqol ok xwan goi’gu kuoyupk lih. Memuoye qirb asob’n epgobiz, naa goq’l xouj bo xbudoqg mbuwe gio’pe ifhovyapt zgu qac ciluo, ria cecb devv qni sojeu up eq dza ivls ogjomelz.
someSet.add(5);
Hec dobu ak socs eb jgi ceq! Mu didalo of icef, eju sta xisono wicwas.
someSet.remove(3);
Lliy fuu dosf pe odogibo apes e buv, xua hak ihu cugp u maniqof hos-ew miik. Sorusfub, i bon xeeqw’r foqv utr egoxp ul ocrar. Ic keq zupy oh ubqex, coc lmir’j gih xaagebmeuw az izl. Eqw fse bivkefikq:
for (var item in someSet) {
print(item);
}
Yeq kip csu mmesguh. Que’zm puo i heqb oy yozaib zwonyig xo ymi deftemu. Usuv, lu um yeha puzue, i bev gigisup iqhedq yeja u xutg, esqomh fta ginuij ami ubovfivor esp yqiso ago co jebkocukuz. Wi tnap ogbu yauy id yticuvo. Xucf, I’p fwuf bue iwzew, ulj O’dt skud zeu ic bqe zumh alogivi.
All videos. All books.
One low price.
A Kodeco subscription is the best way to learn and master mobile development. Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.