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
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
The Stream pipeline replaces Lupe's.
Once again, you will run an array less through a stream pipeline.
Remember that loops can get messy using loops, simple operations on an array list can get really tedious,
but Java offers a cleaner way.
First, you're going to learn about the intermediate operation map, what map does is it updates every
single element in the sequence.
It uses a lambda expression that receives each element.
And returns the updated elements.
Mapped out, Java starts with an array list of four prices.
With tax has the following reference.
The function receives the reference as a parameter, both the parameter and outside variable share a
reference to the same array list.
And so here we're updating elements in the Israelis to include taxes.
Once again, loops are messy and it's easier to run the original list through a stream pipeline.
Were each operation in the pipeline updates the sequence of elements in some way the pipeline is going
to have one intermediate operation map which like filter goes through every element in the sequence,
and map expects us to return the updated elements.
We can use the arrow key that points to the code we're going to write and here will return the updated
value.
That same element times one point one three.
OK, we're going to end the pipeline with the terminal operation collects.
Collect except a collector, which is going to collect the updated sequence of elements and return it
as a list.
You can't store a list of elements in a variable of type array list, but we can add all of the elements
from the list that's being returned by the pipeline.
Let's run this code.
And perfect, once again, running the rails through a pipeline is a lot cleaner than using a loop.
We can clean it up even more, because if you only have one line, the arrow, he can point directly
to the value that we're returning.
You can run to make sure.
And everything works.
All right, finally, you can chain intermediate operations.
In this class, first we filter the lower prices.
Then we update every element in the filtered array list.
OK, I'm going to give you the chance to pause the video and try to work this one out yourself.
OK, so first we're going to filter elements with a price less than five dollars.
The updated sequence continues through the pipeline and the next operation in the pipeline is going
to be map, then we can use map to update every single element from the filtered sequence map receives
each price and returns the updated price.
We're going to end the pipeline with the terminal operation, collect, collect, accepts a collector,
and from the series of collectors, we're going to choose the collector to list, which is going to
accumulate every single element and aggregate it into a list.
And remember, you can't store a list of elements in a variable of type array list, but we can add
all of the elements from the list that's being returned by the pipeline.
First, we're filtering oil price values below five dollars, and then we're updating every element
in that filter sequence.
And we get the expected results.
Let's recap in this lesson, you chained to intermediate operations, the filter operation filters elements
based on a predicate.
The map operation updates every elements.
And finally, a terminal operation ends the pipeline by returning the results.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.