All language subtitles for 010 Bank Management - Part 7 (Tasks 1 – 4)_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 Download
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
ru Russian
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

Welcome to Part seven.

We're going to finalize the bank class, the first task was to create an add transaction method.

This method is going to be public void called transaction.

And it's going to receive a transaction object.

This transaction object we're going to add to the transactions are a list, so we'll say this that transactions

that add and we're going to add to the area list a copy.

A new transaction copy of the object being passed in.

Now, if you go back to the data, go to transactions that text, every transaction has an I.D. that

matches one of the accounts.

So what we need to do is create a method that returns an array of transactions that match a particular

account.

So we'll go to Bank Dot Java.

And we'll call it.

Get transactions, so it's going to return an array of transactions.

Called Get Transactions, it's going to receive an account ID.

Whose transactions we want to return?

Now you might think to credit for a loop that runs through the entire transactions array list and FAA

transactions, it happens to match the account ID added to the array and return that.

But that's really messy.

I would rather use a stream pipeline.

So we're going to say this dart transactions that stream.

And we're going to run the stream of elements through a pipeline of operations.

The first operation we're going to use is the familiar filter operation, and inside we'll go through

every single transaction and filter the ones whose I.D..

Get ID matches, the account ID being passed in.

So at this point, the stream of elements consists of only the filtered transactions, and we're going

to collect this updated stream of elements into a list.

So from the list of collectors.

We're going to choose to list.

This terminal operation is going to return our filtered sequence of elements into our list, so we're

going to say list.

Transaction.

And into this list of objects, we're going to store the result of this pipeline.

Cannot convert from list transaction to a list transaction.

Oh, we got an import list.

All right.

And now this method expects an array, so what we're going to do is return list to array.

Now, the problem is that two Iraq returns an array of objects, which is not good, mortuary can actually

receive an argument and inside the argument, you need to pass in an array of type transaction.

That's how it's going to know, OK, I need to return an array of that custom type.

And when you're creating this array, here is where you put the length in this case, what would you

put a length of one, a length of two, a length of three?

Well, if you want a copy over every element from this list, the length of the array needs to be the

size of the list.

This is the workaround that I use to make sure to array returns an array of a custom type, not of the

generic object type.

OK, now we want to test our code to back on during the Part two, we'll copy this over into main.

Maybe we'll need to import some stuff.

Of course we do.

We'll import transaction.

Should cover all of that will import.

We'll need to add a bank object, so here we'll say bank bank make it static because we're inside main.

OK.

Import Bank.

Is equal to a new object of the bank class.

And now you may not be used to the syntax, but it's just a for a loop that runs through every single

account in the accounts array.

And this one runs through every single transaction in the transactions array.

Like this would be the exact same thing as saying This is just that here.

We don't have to deal with counters.

You can just use the element as is, if you want to use a normal for a loop and say, bank dot transaction

transactions, I mean, that's also fine.

You can do whatever you want.

I'm just going to stick with the code we got from learn the parts.

And anyways, here it adds a bunch of accounts to the bank object.

Here it adds a bunch of transactions to the bank object.

And the idea is that this line over here should filter the transactions that match the account.

F8 4c.

So there should be a total of one two three four five.

Anyways, will place and breakpoint over here.

And test it out.

I'll have to step over this line.

And beautiful.

One, two, three four five transactions.

Let's make sure they're the right ones.

Withdraw a deposit, withdraw, withdraw a deposit, OK?

Our function works perfectly.

OK, now back inside Bangkok, Java, we're going to add the logic for getting the account for a particular

transaction.

So what I'll do here is, I'll say public.

Account.

We're going to get an account corresponds to a transaction I.D..

And once again, you might think to just create a for a loop that runs through the entire length of

the accounts are released.

And if the account happens to match the transaction ID, then return that.

But.

You know, loops are messy, it's better to use a stream pipeline, so here we'll say return accounts

that stream the filter.

We're going to filter the account.

Whose idea?

Matches the transaction ID being passed in.

Place that on a separate line.

There should only be a single account that matches the transaction ID.

So here we're just going to say find first.

So find the first element and the filter at array.

And if they can't find anything, if the array happens to be empty, we'll say or else no.

All right, now, we're going to test our method.

By adding this line inside men.

Over here.

And for the transaction, IDC zero 70.

We get the account where the transaction took place.

See 070 perfect in the next video, we'll continue the remaining tasks.

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