Java Fundamentals - Lesson 44 - Collectors Part 3

preview_player
Показать описание
Are you new to Java development? Do you want to know what to start with? This is a complete stream dedicated to you - the junior developer or future developer.

- Java OCP 11 certification
- Learn Java basics
- Find a junior java developer role

If your target is at least one of the above, then this lesson streaming is for you. Join!

Don't forget to follow me on Twitter @laurspilca or LinkedIn for more posts and discussions.

Рекомендации по теме
Комментарии
Автор

Thanks for the lessons and the final exercises. You are a great teacher :)

MateoEstudiante
Автор

These lessons are really helping in making concepts clear. Got a complete clarity of how optional has to be used. Thanks you.

AmitMishra-rino
Автор

Hi, great vid as always, thanks a lot :) I am currently working with rest APIs so I can tell that 201 is created and 204 is no content :)

mirageman
Автор

Sir please cover the the collectingAndThen

priyanshu
Автор

Why doesn’t Integer provide its own Comparator?

rydmerlin
Автор

HI Laurentiu, hope you are doing good....
I have a question in the following code

{

//Optional is a way to avoid using null values...
// Stream<Integer> s1 = Stream.empty();
Stream<Integer> s2 = Stream.of(10, 20, 50, 30);



Optional<Integer> o1 = s2.findFirst();
// Value [10]


System.out.println(o1);
System.out.println("S2: " + s2.toString());


List<Integer> list1 =
//ERROR LINE:24

// o1.stream()
// // works but it just send the value 10

// System.out.println(" LIST: " + list1);
//

//

// o1.ifPresent(x -> System.out.println(x));


}

Also tried to get String to print: But this was output.... can you help?

when you use the Stream, I have come to learn that it closes for example Optional<Integer> o = s1.findFirst();

Optional<Integer> o1 = s2.findFirst();
I call the stream again ... and it gives me an exception saying that the stream is closed
I thought it was always available... which is not the case... is that correct... after this can you reopen the stream or only one use?

"-javaagent:D:\Program Files\JetBrains\IntelliJ IDEA Community Edition Files\JetBrains\IntelliJ IDEA Community Edition 2019.3\bin" -Dfile.encoding=UTF-8 -classpath Example1.Example1
Optional[10]
Exception in thread "main" stream has already been operated upon or closed
at
at
at

Process finished with exit code 1

peterfraga
visit shbcf.ru