Whoa this is a lot simpler than the method I had found, though slightly less flexible. I think I'll use this way of sorting on multiple fields in the future for a lot of 'one-time' sorting jobs where I don't necessarily need to sort the data in a lot of different ways.
Thanks for video/ I have an issue with this way of sorting though. Because, when the first field is sorted , second one is ignored/ For ex suppose there are two fields Age and name , & i intend to sort on age and name both. So if there are two entries with age 34, and name as Abhi and Nutan, I need Abhi to appear first in the list and then Nutan. How do I achieve this?
Excellent explanation. Adding to your video.. we can do something like below in java8 with multiple fields: listOfEmps.stream().sorted(Comparator.comparing(Employee::getEmpId).thenComparing(Employee::getEmpName)).forEach(System.out::println);
Hi , Hashmap have a key as orgid and value as emplist Ex: Map Employee class have empid ,empsalary Need to sort the hash map based on emp salary ??? Is it possible .. can u please explain the same with code .. Thanks, Karthic Sakthivel
This was a perfect explanation of a very specific question. Thanks!
simple and good explanation
Great Explanation!
Good tutorial
This is a awesome viedo everytime i go for interview I watch this viedo
Way of teaching is very good ....very easy and simple thanks
Thankyou, my issue got resolved from this logic.
Whoa this is a lot simpler than the method I had found, though slightly less flexible. I think I'll use this way of sorting on multiple fields in the future for a lot of 'one-time' sorting jobs where I don't necessarily need to sort the data in a lot of different ways.
thank you sir.great health to you
sorting on two fields, great explanation sir. Thank you.
You are a good teacher . Thanks it is very helpful
Awesome explanation. Thank you Sir.
Very helpful thanks a lot
Thanks for video/ I have an issue with this way of sorting though. Because, when the first field is sorted , second one is ignored/ For ex suppose there are two fields Age and name , & i intend to sort on age and name both. So if there are two entries with age 34, and name as Abhi and Nutan, I need Abhi to appear first in the list and then Nutan. How do I achieve this?
Excellent explanation. Adding to your video.. we can do something like below in java8 with multiple fields:
listOfEmps.stream().sorted(Comparator.comparing(Employee::getEmpId).thenComparing(Employee::getEmpName)).forEach(System.out::println);
Very helpful, thank you. Can you do a video on how to sort data in a CSV file?
Thanks Bushari. Yes I will make a video for this next.
Thank you for your explanation, but you had sorted department only not name... can we sort both name, department together.
thanks a lot...
THANK YOU!!!!!!!
Hi ,
Hashmap have a key as orgid and value as emplist
Ex:
Map
Employee class have empid ,empsalary
Need to sort the hash map based on emp salary ??? Is it possible .. can u please explain the same with code ..
Thanks,
Karthic Sakthivel
Excellent !!! Quite accurate !