All language subtitles for 015 Filtering Lists_en

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranรฎ)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu

Original subtitles

In this section, we're going to move on to our next method, the deal method, the deal method is going

to be pretty critical inside of our program because just about every card game in the world involves

dealing some number of cards to a player.

We're going to, again, make use of a built-In method on the list class for implementing deal, but

it's not going to be quite as easy as it was the last time that we used a built in method.

Let's go look at the documentation of what we're going to use and we'll talk about why this is going

to be a little bit more on the challenging side.

OK, so here's the latest class documentation, I'm going to scroll down a bit until I find the method

section and then in the method section, I'm going to find the method called sublist.

Here it is right here.

So the sublist method takes two integers representing a start point and an endpoint.

It will then return a new list that contains all the objects from that START index or that kind of start

element that we passed in all the way to the end element exclusive.

So that means that we'll take it all the way, not including to that last one.

So the sublist method right here is a little bit deceptive, a little bit deceptive.

Let me show you a diagram that's going to help you understand why.

OK, so let's imagine that you and I in the real world.

OK, so this diagram right here is going to be reflecting the real world.

If I had a deck of cards like you see right here, and I wanted to deal you a couple of cards out of

his hand, you would probably expect to see something like this happen.

You would expect to see.

Let me just put this in back real quick, that if I took card zero and put it into your hands, it would

be moved down.

And if I took a card one and gave it to you, it would move down to your hand as well.

And so this big box down here represents your hand or the cards that I'm dealing to you.

So in other words, if I give you a card out of my deck, chances are I don't retain access to it anymore.

So just to be clear, that's probably how you would expect this deal function to work.

If I deal you a card, I no longer have control of it.

However, that is not how the sublist method right here works.

And so it's a little bit surprising.

Here's how sublist works instead.

So a sublist, we're going to take some number of elements out of this original list and they're going

to be it's going to appear that they get duplicated over to this new list as well.

So when I deal you a card, it's going to appear that it stays in my hand.

But it also appears in your hand as well.

So this is kind of interesting on two fronts.

First off, it really doesn't reflect how you and I probably want our deal method to work, you and

I, for the purposes of our program.

We probably want to make sure that if I deal you a hand of cards, I no longer have access to them.

So that's kind of a requirement of our program.

We definitely want to make sure things work that way.

But the second thing that's kind of interesting is how it will appear that our card is being duplicated

between these two lists.

However, here's the interesting thing is that this is the entire point of all this discussion about

dealing these cards.

These cards do not actually get duplicated when they are put into this new list.

So let's take a look at a diagram that's going to help you understand how these list objects work in

DART.

OK.

All right.

So we're going to pull up a diagram.

So we've again, got a diagram of the memory in your computer.

So this is kind of a diagram of what's going on inside the memory on your machine when you are going

to run our program.

When you use Dart and you create a list, you end up putting some number of elements into that list

and we really think of that list as like containing these elements or containing these objects.

But in reality, that's not quite the case.

You see, when we create these cards, they are created in some random location, in memory, like maybe

once here and once here in another one's here.

And so each of these boxes represent the actual instance of the class that contains the rank and the

suit of a particular card.

The card object itself in memory is not actually inserted into the list.

Instead, our list object right here contains a reference that points over to card number one or at

index number one.

Here inside the list, we've got a reference that points over to card number two in a reference that

points over to card number three.

So when we run the sublist method on this list right here and try to pull off kind of like a subset

of records, the records are not actually being duplicated.

Instead, we are creating a second list.

It's like it's kind of you can kind of imagine, it appears over here and in that list, in this brand

new one, we get the exact same references that point back to those same objects.

So, again, it's going to appear that these cards get duplicated over to the new list, but they're

not actually duplicated.

It's the same exact card in memory.

And so if we change the card right here or what appears to be right here, it's going to modify that

card that appears to be over here as well, because they are not actually contained within the list.

OK, so this is this idea of references versus actual values, you might be kind of getting the idea

here that it's kind of important in the world of dirt, and that's completely correct.

So we really want to make sure that whenever we're working with values or references or variables,

we really have an idea of which one we're dealing with.

So let's take a break right here.

We're going to come back to the next section.

And now that we're armed with this knowledge of how that.

Sublist method actually works, I think we'll be able to put together a working deal function.

So quick break and I'll see you in just a minute.

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.