All language subtitles for 009 Stream Pipeline – Part 2_en
Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranî)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,360 --> 00:00:02,370
The Stream pipeline replaces Lupe's.
2
00:00:03,969 --> 00:00:07,300
Once again, you will run an array less through a stream pipeline.
3
00:00:09,620 --> 00:00:16,450
Remember that loops can get messy using loops, simple operations on an array list can get really tedious,
4
00:00:16,760 --> 00:00:18,550
but Java offers a cleaner way.
5
00:00:21,400 --> 00:00:26,920
First, you're going to learn about the intermediate operation map, what map does is it updates every
6
00:00:26,920 --> 00:00:28,750
single element in the sequence.
7
00:00:30,760 --> 00:00:34,270
It uses a lambda expression that receives each element.
8
00:00:35,630 --> 00:00:37,880
And returns the updated elements.
9
00:00:41,410 --> 00:00:44,350
Mapped out, Java starts with an array list of four prices.
10
00:00:49,040 --> 00:00:51,080
With tax has the following reference.
11
00:00:53,010 --> 00:00:58,710
The function receives the reference as a parameter, both the parameter and outside variable share a
12
00:00:58,710 --> 00:01:00,270
reference to the same array list.
13
00:01:00,630 --> 00:01:04,230
And so here we're updating elements in the Israelis to include taxes.
14
00:01:17,660 --> 00:01:23,270
Once again, loops are messy and it's easier to run the original list through a stream pipeline.
15
00:01:26,430 --> 00:01:32,130
Were each operation in the pipeline updates the sequence of elements in some way the pipeline is going
16
00:01:32,130 --> 00:01:38,250
to have one intermediate operation map which like filter goes through every element in the sequence,
17
00:01:38,610 --> 00:01:42,140
and map expects us to return the updated elements.
18
00:01:42,630 --> 00:01:48,060
We can use the arrow key that points to the code we're going to write and here will return the updated
19
00:01:48,060 --> 00:01:48,540
value.
20
00:01:48,540 --> 00:01:51,600
That same element times one point one three.
21
00:01:53,210 --> 00:01:56,810
OK, we're going to end the pipeline with the terminal operation collects.
22
00:01:58,840 --> 00:02:04,300
Collect except a collector, which is going to collect the updated sequence of elements and return it
23
00:02:04,300 --> 00:02:04,930
as a list.
24
00:02:17,520 --> 00:02:23,820
You can't store a list of elements in a variable of type array list, but we can add all of the elements
25
00:02:23,820 --> 00:02:26,460
from the list that's being returned by the pipeline.
26
00:02:32,890 --> 00:02:33,910
Let's run this code.
27
00:02:46,160 --> 00:02:51,950
And perfect, once again, running the rails through a pipeline is a lot cleaner than using a loop.
28
00:02:56,410 --> 00:03:01,450
We can clean it up even more, because if you only have one line, the arrow, he can point directly
29
00:03:01,450 --> 00:03:03,070
to the value that we're returning.
30
00:03:11,710 --> 00:03:13,090
You can run to make sure.
31
00:03:23,270 --> 00:03:24,350
And everything works.
32
00:03:27,690 --> 00:03:31,380
All right, finally, you can chain intermediate operations.
33
00:03:34,490 --> 00:03:37,280
In this class, first we filter the lower prices.
34
00:03:42,130 --> 00:03:45,310
Then we update every element in the filtered array list.
35
00:03:56,620 --> 00:04:01,000
OK, I'm going to give you the chance to pause the video and try to work this one out yourself.
36
00:04:07,480 --> 00:04:11,860
OK, so first we're going to filter elements with a price less than five dollars.
37
00:04:31,670 --> 00:04:36,980
The updated sequence continues through the pipeline and the next operation in the pipeline is going
38
00:04:36,980 --> 00:04:44,360
to be map, then we can use map to update every single element from the filtered sequence map receives
39
00:04:44,360 --> 00:04:47,150
each price and returns the updated price.
40
00:04:52,290 --> 00:04:57,870
We're going to end the pipeline with the terminal operation, collect, collect, accepts a collector,
41
00:04:58,200 --> 00:05:03,570
and from the series of collectors, we're going to choose the collector to list, which is going to
42
00:05:03,570 --> 00:05:07,230
accumulate every single element and aggregate it into a list.
43
00:05:08,940 --> 00:05:15,300
And remember, you can't store a list of elements in a variable of type array list, but we can add
44
00:05:15,300 --> 00:05:19,230
all of the elements from the list that's being returned by the pipeline.
45
00:05:36,240 --> 00:05:41,220
First, we're filtering oil price values below five dollars, and then we're updating every element
46
00:05:41,220 --> 00:05:42,900
in that filter sequence.
47
00:05:49,570 --> 00:05:51,610
And we get the expected results.
48
00:05:55,800 --> 00:06:02,700
Let's recap in this lesson, you chained to intermediate operations, the filter operation filters elements
49
00:06:02,700 --> 00:06:03,860
based on a predicate.
50
00:06:04,500 --> 00:06:07,080
The map operation updates every elements.
51
00:06:07,350 --> 00:06:11,880
And finally, a terminal operation ends the pipeline by returning the results.
5262
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.