Java 8  Stream -  How to Sort a List using lambda | Example | Java Techie

Java 8 Stream - How to Sort a List using lambda | Example | Java Techie

Java Techie

5 лет назад

59,010 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@Ravinanik
@Ravinanik - 11.11.2023 18:02

How to sort reverse using comparing method

Ответить
@raghunathhembram9962
@raghunathhembram9962 - 26.10.2023 19:00

sir can we sort the list of number without using sorted method by using stream api in java

Ответить
@RexSmithHardy-um6gf
@RexSmithHardy-um6gf - 13.10.2023 08:01

While sorting why do you want to downcast Long to int? Either while declaring the field you should have made it as int or proceed with logic for Long which is a much better real time example

Ответить
@fjkldhakljf
@fjkldhakljf - 11.04.2023 22:22

Great work sir , I admire your ability to give motivation for examples and follow through steps of why this way is better than alternatives

Ответить
@sarojgupta8181
@sarojgupta8181 - 21.09.2022 08:56

wow its superb :)

Ответить
@oguzhan2393
@oguzhan2393 - 09.09.2022 09:24

you are really doing great things. I was watching a guy who was really idiot. called amigo. something. But mate you are really doing good things thanks.

Ответить
@BooSgu
@BooSgu - 20.08.2022 08:51

Simple explanation and easy to understand. Thank you very much.

Ответить
@sumitjain3526
@sumitjain3526 - 17.07.2022 18:30

Thank you so much

Ответить
@vamsikondaparthik9934
@vamsikondaparthik9934 - 31.05.2022 07:56

Thanks for the Tutorial.

In Java 11 i am unable to call getter and setter methods in comparing method like below:
listEmployee.stream().sorted(Comparator.comparing(emp->emp.getName)

Could you please help me with this.

Ответить
@ANKITCHOUDHARYankitkrchy
@ANKITCHOUDHARYankitkrchy - 03.05.2022 22:41

Commendable job

Ответить
@vipinvenugopal3166
@vipinvenugopal3166 - 19.04.2022 19:02

Thanks

Ответить
@kishordige4654
@kishordige4654 - 03.04.2022 15:24

Thank you! You are a great Teacher

Ответить
@sameer838
@sameer838 - 31.03.2022 10:02

Great

Ответить
@kishyash1
@kishyash1 - 17.03.2022 10:54

Hii vasant, how will we do customized sorting in descending order using method reference ? (Comparator.comparing(Employee::getName)). This will give me sorting in ascending order but i want in descending order.

Ответить
@niranjanp8194
@niranjanp8194 - 16.03.2022 08:46

Perfect example bro. keep it up.

Ответить
@saurabh7489
@saurabh7489 - 05.11.2021 17:29

Great video. Thank you very much.

Here is what I do for a list of objects:

employees.sort(Comparator.comparing(Employee::getSalary));

employees.sort(Comparator.comparing(Employee::getSalary).reversed());

Ответить
@maruthidanda2364
@maruthidanda2364 - 01.10.2021 19:06

Super super

Ответить
@amitkharbade
@amitkharbade - 08.09.2021 14:33

Thanks for another useful tutorial

Ответить
@vishalpradhan9881793197
@vishalpradhan9881793197 - 28.08.2021 13:16

writing comment from terminal

Ответить
@vishalpradhan9881793197
@vishalpradhan9881793197 - 28.08.2021 13:10

writing comment from UI

Ответить
@pankajkm884
@pankajkm884 - 25.08.2021 06:31

getName method is not static method. It is instance method. So, how you can call it by Class reference method?

Ответить
@umaparvathi606
@umaparvathi606 - 16.07.2021 21:58

All the topics very nice sir

Ответить
@ramanshrestha3851
@ramanshrestha3851 - 25.06.2021 10:15

Nice video, keep uploading useful videos related to Java. Thanks

Ответить
@mydreamworld29
@mydreamworld29 - 08.04.2021 09:38

Well explained. Thanks

Ответить
@vandana89100
@vandana89100 - 31.03.2021 23:39

Hats off to you for making life easier👍🏻

Ответить
@nameshd658
@nameshd658 - 21.03.2021 18:24

Wow man... I'm doing your programming series one by one every day... This is day #7.. Thanks a lot bro. Awesome tutorial !!!

Ответить
@ashishchoudhary9824
@ashishchoudhary9824 - 21.03.2021 05:49

Hii vasant, how will we do customized sorting in descending order using method reference ? (Comparator.comparing(Employee::getName)). This will give me sorting in ascending order but i want in descending order.
Or i want sorting based on length of employee name, how will do using stream api ?
Thanks.

Ответить
@sinurao1017
@sinurao1017 - 02.03.2021 19:34

Super JT

Ответить
@saurabhkailashchandrapuran8609
@saurabhkailashchandrapuran8609 - 12.11.2020 14:44

how to sort on custom two fields like with name and salary both at a time

Ответить
@mohammedshabbir1347
@mohammedshabbir1347 - 20.09.2020 20:04

Awesome explanation. Thanks Basant.

Ответить
@pradiptagure7492
@pradiptagure7492 - 27.08.2020 06:48

Very good tutorial. It helped me. But one question, at the comparing example, it is sorting ascending by default. If I need to do, descending as well, how to achieve that?

Ответить
@baibhavghimire3827
@baibhavghimire3827 - 31.07.2020 06:46

You deserve more subscription..I am doing that..Thanks man for going through the basis and connecting dots.

Ответить
@hardikjotangia2642
@hardikjotangia2642 - 30.07.2020 22:46

Sir, when I am doing shorting I want new shorted list, How to achieve this?

Ответить
@manimarankrishnamoorthy8172
@manimarankrishnamoorthy8172 - 30.06.2020 19:19

Nicely explained..Great.

Ответить
@omsonschicago5872
@omsonschicago5872 - 04.05.2020 23:43

Thank you so much

Ответить
@BookWormsOriginal
@BookWormsOriginal - 07.04.2020 20:01

The most simplistic and to the point explanation, you made my day! Thanks a lot! You deserve to be subscribed to!

Ответить
@RaulSC9
@RaulSC9 - 28.01.2020 12:50

Thanks!!

Ответить
@kodandaramkodakanti3715
@kodandaramkodakanti3715 - 05.01.2020 21:24

Excellent Bro... I'm very satisfied with this explanation.. Thanks a lot and keep posting videos...

Ответить
@johngather4055
@johngather4055 - 12.11.2019 08:26

thnks why u are overriding equals and hashcode for custom employee

Ответить
@saswatidas6217
@saswatidas6217 - 19.09.2019 17:22

Could you please explain more about method reference ?

Ответить
@TheMihan123
@TheMihan123 - 13.09.2019 21:26

Thanks ! nicely explained .

Ответить
@rahulkaranjavkar7994
@rahulkaranjavkar7994 - 28.05.2019 21:02

Thanks...

Ответить
@sujithg5873
@sujithg5873 - 31.03.2019 09:20

Can u detailed explanation for method reference

Ответить
@ILuvBilli
@ILuvBilli - 29.03.2019 17:35

Superbbbb

Ответить
@siyedyoussef3202
@siyedyoussef3202 - 28.03.2019 23:24

Great java 8 playlist video 👍👍👍👍

Ответить
@naveenc4963
@naveenc4963 - 28.03.2019 10:46

Nice explanation bro
Can you share the Java 8 features example codes

Ответить