this is really good video for those who are lagging in doing programming with corejava.... if any one practice this and learn doing on their own..they ll start become stronger and stronger intheir coding skillls... thanks for the good work..
Sir, I cant thank you more, today I had 2nd technical round with TechM, the interviewer asked the same question, that how you will group male and female on the basis of dept. but you are getting the Dept. name as a method argument. I randomly watched this video 3-4 days back and today when interviewer asked this question, I could only think about this video and provided him the solution in a minute.
for me remembering the entire syntax is tough. I don't know how would someone memorize the entire syntax and get the expected result LOL😇 Thank you Basant for creating amazing content!
After watching these kind of videos from you ...i am just thinking how some one like you❤ got this much of depth knowledge in java ... could you please explain me in one word??
Thats a very good approach to teaching Basanth✌️ Liked it👍 Also would like to suggest if you could add a bigger display then the whole code we might get to see the single screen.
I have made it by the following way Employee nthHighestEmployee = employees.stream() .sorted(Comparator.comparingDouble(Employee::getSalary).reversed()).skip(n - 1).findFirst() .orElse(null);
The solution based on sorting is not optimal. min/max heaps should be used. can the Java Stream API provide the optimal solution based on the min/max heaps?
Hi Sir why you have used "Collections.reverseOrder(Map.Entry.comparingByKey())" insted of "Comparator.comparing(Map.Entry.comparingByKey()).reversed()"
I have upcoming interview 2nd round on Friday. I know backend spring boot but am not aware of java 8 and all crucial features and usecases of it, i am told it will be asked for sure. Can you please suggest me few sources to understand everything about java 8 from scratch?? Or best make a small playlist if possible. Humble request! Could be Life changing for me!
Hi ,I have list of employee objects I just want sort my employee list based on name in ascending order age in descending order ,salary in ascending order at a time How we make this combine sort ?
Can you please help on a interview question where they asked to create a person class that has some fields like id, name, address, age etc and there can be 100+ such field in person class. We need to write a program to sort the person data using some dynamic criteria, like sample criteria can be Id only Id+ name Name onky Age onky Id+name+age And so on Can you help me on this.. She suggested to use reflection api getdeclaredfield method and getproperty to solve yhis...which i cud not relate to
Hello Sir, thank for this 👍👌 i have one question face by Cognizant that there is an array of integers he wanted out put as - { { 1,1,1,1},{2,1,1},{2,2},{3,1} } all possible combination of numbers whose sum is 4 if 4 is passed from console, if i pass 5 then all possible sum and so on could you help to make a video of it...plz
Thanks a lot for your Response :) :) this is not what he was expecting for example - i will pass 4 from console then output should be - { { 1,1,1,1},{2,1,1},{2,2},{3,1} } For example i will pass 5 then output should be - { { 1,1,1,1,1},{2,2,1},{3,2},{4,1} } For example i will pass 6 then output should be - { { 1,1,1,1,1,1},{2,2,2},{3,3},{4,2},{5,1} }
Sir please tell me how extract Text, table, images data from pdf using java. I am able to extracting text but remaining things how to get please tell me any solution
Hello Sir, Nice content and thanks for detailed explanation. I have one question for sorting applied after grouping, Since the map key is Integer than shouldn't this apply sorting by default by using sort() method without passing Comparator implementation? I tried this but it failed and hence I thought to ask here ruclips.net/video/eBDN04LlEOg/видео.html
@@Javatechie Apologies for confusion. I thought entry set can be sorted by using just sorted() method. It is clear that we need to pass Comparator for sorting of entry set.
Map dataMap = new HashMap(); dataMap.put("Bharat",10000); dataMap.put("Ram",1200); dataMap.put("Laxman",1600); dataMap.put("Ravan",4500); dataMap.put("Lav",5230); Map.Entry nthHighest = dataMap.entrySet().stream() .sorted(Map.Entry.comparingByValue(Comparator.reverseOrder())) .skip(2) .findFirst() .get(); System.out.println(nthHighest); //Can be done this way also
Sir, I cant thank you more, today I had 2nd technical round with TechM, the interviewer asked the same question, that how you will group male and female on the basis of dept. but you are getting the Dept. name as a method argument. I randomly watched this video 3-4 days back and today when interviewer asked this question, I could only think about this video and provided him the solution in a minute.
Excellent, plz bring such new types of java coding questions in your upcoming videos...
this is really good video for those who are lagging in doing programming with corejava.... if any one practice this and learn doing on their own..they ll start become stronger and stronger intheir coding skillls... thanks for the good work..
Sir, I cant thank you more, today I had 2nd technical round with TechM, the interviewer asked the same question, that how you will group male and female on the basis of dept. but you are getting the Dept. name as a method argument. I randomly watched this video 3-4 days back and today when interviewer asked this question, I could only think about this video and provided him the solution in a minute.
Glad to hear this buddy 🥰🥰. Keep learning 😃
Your experience. How much package they offered??
Nice incremental way of teaching streams in general.
for me remembering the entire syntax is tough. I don't know how would someone memorize the entire syntax and get the expected result LOL😇
Thank you Basant for creating amazing content!
What a useful content and example. Thanks for sharing
Thank Your very Much sir. Many programmers are learn more knowledge by yours videos.
Hello Sir,
Pls explain this interview question
int[] numbers = {1, 5, 7, -1, 5}
out put is (1,5),(7,-1),(5,1) and combination is 3
Here combination is 6 right? You need to figure out pair whose sum is given input
In output we got the map has key salary and value name, but if I want same map in which key is name and salary is value is it possible?
After watching these kind of videos from you ...i am just thinking how some one like you❤ got this much of depth knowledge in java ... could you please explain me in one word??
May be he tried multiple times in offline.
I think the permanent hunger of learning helps everyone , thank you so much for your valuable words.
Of course Kk , i have tried it and understand the purpose of each line before preparing the video .
@@PKKCAD nothing is without practicing
Hi please bring a complete tutorial on multi threading programing. As of no complete vedio tutorial i have found on RUclips.
Okay buddy i will
Thats a very good approach to teaching Basanth✌️ Liked it👍 Also would like to suggest if you could add a bigger display then the whole code we might get to see the single screen.
Nice way of delivering such complicated looking problem.
Optional secondHighestEmployee = employees.stream()
.collect(Collectors.groupingBy(Employee::getSalary, TreeMap::new, toList()))
.entrySet()
.stream()
.skip(n-1)//
.map(Map.Entry::getValue)
.findFirst();
System.out.println(secondHighestEmployee);
Employees is a list or map
Thank you. Could you please explain how to write program for placing n queen in n*n board?
Thanks Basanth.Nice Video. God bless you.
I have made it by the following way Employee nthHighestEmployee = employees.stream()
.sorted(Comparator.comparingDouble(Employee::getSalary).reversed()).skip(n - 1).findFirst()
.orElse(null);
If multiple employees have the same value will it work ?
@@Javatechie Yes it will take the previous value for 3rd highest salary. e.g . List employees = new ArrayList();
employees.add(new Employee(101, "John", 5000));
employees.add(new Employee(102, "Alice", 8000));
employees.add(new Employee(103, "Bob", 3000));
employees.add(new Employee(104, "Mary", 6000));
employees.add(new Employee(105, "Tom", 2000));
employees.add(new Employee(106, "Jane", 7000));
employees.add(new Employee(108, "Rabi", 6000));
employees.add(new Employee(107, "Mike", 4000)); Output:- Employee [empId=104, empName=Mary, salary=6000]
The solution based on sorting is not optimal.
min/max heaps should be used.
can the Java Stream API provide the optimal solution based on the min/max heaps?
Nice
Can you make an real example of Optional where use some frequent and important methods like OrElseGet() etc
Hey thank you so much you deserve lasts of appreciation, but I expected not enough from you
Amazing videos for java techies.
Hi Sir why you have used "Collections.reverseOrder(Map.Entry.comparingByKey())" insted of "Comparator.comparing(Map.Entry.comparingByKey()).reversed()"
I have upcoming interview 2nd round on Friday. I know backend spring boot but am not aware of java 8 and all crucial features and usecases of it, i am told it will be asked for sure.
Can you please suggest me few sources to understand everything about java 8 from scratch?? Or best make a small playlist if possible.
Humble request! Could be Life changing for me!
It's already there please have a look
ruclips.net/p/PLVz2XdJiJQxzrdrpglCv_nWIO5CDIqOVj
Completed the playlist!
It's pure Gem. Thanks man.
@@siddharthagrawal4280 u got selected ?
@@raviravi-gg5ck yes bro! This is great source for getting industry ready
We want more this kind of videos.
Kindly make a video on fetching Arrey Index of top 4 records from millions of record in a database.
Even if you cant...no worries..thanks for your efforts in making these videos that are of so much help
Thanks for good content. Hope you keep sharing on((:
Hi ,I have list of employee objects I just want sort my employee list based on name in ascending order age in descending order ,salary in ascending order at a time
How we make this combine sort ?
You need to customize your comparator. There is no direct support given by java 8
Can you make video on how to switch from service based company to product based company?
If I'm passing num value gt than size of sorted list, it will fail at get(index). What we can do in that case on streams?
Definitely it will fail, so you need to validate that num
Optionalsecodhighest=list.stream().sorted(Comparator.comparing(Employee::getSalary)).skip(3).findFirst();
sysout(secondhghest) -- is this correct?
Big thanks from Africa
Excellent tutorial Bro!! Please keep post solving new problems!!
Can you please help on a interview question where they asked to create a person class that has some fields like id, name, address, age etc and there can be 100+ such field in person class.
We need to write a program to sort the person data using some dynamic criteria, like sample criteria can be
Id only
Id+ name
Name onky
Age onky
Id+name+age
And so on
Can you help me on this..
She suggested to use reflection api getdeclaredfield method and getproperty to solve yhis...which i cud not relate to
Sure i will check this buddy. Quite interesting
@@Javatechie thank you so much!!
superb content
Awesome 👍
Sir I LRU and LFU cache using LinkedHashMap please. I failed epam interview because of LFU cache.
Okay i will
@@Javatechie thank you Sir.
Hello Sir, thank for this 👍👌 i have one question face by Cognizant that there is an array of integers he wanted out put as - { { 1,1,1,1},{2,1,1},{2,2},{3,1} } all possible combination of numbers whose sum is 4 if 4 is passed from console, if i pass 5 then all possible sum and so on could you help to make a video of it...plz
It's very simple you can try the approach below
import java.util.stream.IntStream;
public class NumberCombinationSum {
public static void main(String[] args) {
int targetSum = 10;
findCombinations(targetSum);
}
public static void findCombinations(int targetSum) {
IntStream.rangeClosed(1, targetSum / 2)
.forEach(num1 -> {
int num2 = targetSum - num1;
System.out.println(num1 + " + " + num2 + " = " + targetSum);
});
}
}
Thanks a lot for your Response :) :)
this is not what he was expecting for example - i will pass 4 from console then output should be - { { 1,1,1,1},{2,1,1},{2,2},{3,1} }
For example i will pass 5 then output should be - { { 1,1,1,1,1},{2,2,1},{3,2},{4,1} }
For example i will pass 6 then output should be - { { 1,1,1,1,1,1},{2,2,2},{3,3},{4,2},{5,1} }
Ohh okay got it any combination. Will try and update you
Sir please tell me how extract Text, table, images data from pdf using java. I am able to extracting text but remaining things how to get please tell me any solution
Good video bro. Please make a more videos on java8 interview questions
Already uploaded buddy please search with keyword interview
Bro realtime project implement action series chey bro
Good one brother
can you please make video on functional interface with recursive?
Recursive function class?
@@Javatechie No Recursive with lambda implementation any logic like factorial given number consider as example.
can you please try this find the largest word in a string in java
Thank you
Thanks
Hi bro.. ur videos are more clear. Are you working in software company?
Thank you buddy Yes i am a working employee in it
I was asked in a interview How to remove adjacent duplicates of a string in java8
Try below approach
public static String removeAdjacentDuplicates(String input) {
return input.chars()
.mapToObj(c -> (char) c)
.collect(StringBuilder::new, (sb, c) -> {
if (sb.length() == 0 || sb.charAt(sb.length() - 1) != c) {
sb.append(c);
}
}, StringBuilder::append)
.toString();
}
great
Good one ❤
And also debugging process in realtime project chey bro series
Please check this link buddy ruclips.net/video/Kon1DGwbtzg/видео.html
How many years experience interview was this?
4+, but it can ask a fresher or even can ask to n+ experience
👍
Experience ??
🙏👍
Hello Sir, Nice content and thanks for detailed explanation. I have one question for sorting applied after grouping, Since the map key is Integer than shouldn't this apply sorting by default by using sort() method without passing Comparator implementation? I tried this but it failed and hence I thought to ask here
ruclips.net/video/eBDN04LlEOg/видео.html
Not getting you buddy could you please elaborate it little bit
@@Javatechie Apologies for confusion. I thought entry set can be sorted by using just sorted() method. It is clear that we need to pass Comparator for sorting of entry set.
Np
private static Entry getnthHighestSalaryEmployeeName(Map mappedWithSalary, Integer n) {
return mappedWithSalary.entrySet().stream()
.sorted(Collections.reverseOrder(Map.Entry.comparingByKey()))
.skip(n - 1)
.findFirst()
.orElse(null);
}
Execute this with different input there is a loop whole
Map dataMap = new HashMap();
dataMap.put("Bharat",10000);
dataMap.put("Ram",1200);
dataMap.put("Laxman",1600);
dataMap.put("Ravan",4500);
dataMap.put("Lav",5230);
Map.Entry nthHighest = dataMap.entrySet().stream()
.sorted(Map.Entry.comparingByValue(Comparator.reverseOrder()))
.skip(2)
.findFirst()
.get();
System.out.println(nthHighest); //Can be done this way also
It will not consider the case when two people have same salary I guess
Saroj yes if there will be more than 1 employee having the same salary it won't work
Sir, I cant thank you more, today I had 2nd technical round with TechM, the interviewer asked the same question, that how you will group male and female on the basis of dept. but you are getting the Dept. name as a method argument. I randomly watched this video 3-4 days back and today when interviewer asked this question, I could only think about this video and provided him the solution in a minute.
Hi Kshitij,
What would be the data format to group male and female on the basis of dept?
You have been placed?