 Good morning guys, welcome to our channel, so in this video I will be sharing you one of the interview questions that I have recently found with Tech Mahindra, so these were the only two questions that I was unable to answer and that two were on very simple questions and that were related to Java 8, so thought of sharing out with you guys as well. So the question was simple, to find the vowels count in a string and to find the duplicate synestring, but using streams, so normally it is very simple, dead easy to be honest to find the duplicates or to find the vowel synestring, but using Java 8 to be honest I was not able to give a solution for that, so thought it might be helpful to at least few who might not be aware of how to apply stream on normal string, so sharing the solution for that first question, how to find count, so the main thing here is, I have already have input, this was the input, hello hello and one was hi hi, so let us take the input dot and there is one method called cache which will give an int stream, so this method I was not aware of it, because to be honest like in the real time projects we do not use or like I have not worked on to be honest like on this method, so I was not able to give, so this will return int stream and now we can have filter, so if you can see here filter method is expecting an int predicate, so now how can we have our answer, the int predicate will have a test method, okay what happened, let us take an a as x, then I will directly return x, we can have the brackets x double equals a or x double equals a sorry e or simply I will take out paste this, a e i o u okay a e i o, so let us see what okay let me break this into two lines, so what is the issue, why okay predicate this is wrong, so this is how we can have then directly count which will return along here semicolon where we called here as well, let us cache long count, so this is the logic that goes here, so cache was the important method that I forgot and was not able to give a solution, like normal solution I was able to do converting the string into string carrier is then having that carrier having a for loop and in that process I was able to do, but using this I was unable to know let us print the count of holes here number of, so let me run this application and see whether that is correct or not, so number of holes are four how a e i o u e and two times that got repeated and that are four and there was one more question find the duplicates now, so how to find the duplicates let us discuss, so before discussing the next solution if you want to contribute us anything you can use the amazon affiliation link that is present in the description before on your next by, so now let us see how can we find the duplicates on the given input, so take the input dot cache, cache method directly we can apply what method here map to int, map to, sorry map to object we can use, so here so let me remove the null let us convert this into cache, here no let me break it dot dot what we can have here we can directly collect using what we can collect we can use collectors dot grouping by where is scooping by grouping by and what based on what directly object class method reference we are using two string would be the key comma counting collectors counting counting is the method, now let me break this again collectors dot group of letters, so this is the value, so this is what we can have, so this is how we can find duplicates now what will it return output let us take is as output and it will return a map here create a local variable, so it has written the map and now let us print this map how can we print using forage, how dot forage what we get key value sysout base value, so that's it what happened right so this was the class what happened okay let us save and let us run this so we got the output so space is one time e is two times h two times l four times and o two times so this is how we can use up we can apply streams on string class and using those two things we can give a solution because going forward in every interview question you may be asked this question because everybody is asking huge number of questions on streams like whatever question is there they are expecting us to give a solution using stream so thought of sharing this video I hope this might be helpful to at least few people so this is so what all we have used java it features your streams we have used we have used grouping by collectors we have used forage method and we have used method reference here we have used lambdas here so this all things we have used I hope even here we have used in predicate interface which is the functional interface it which has only test method here so these all things we have used this thing in this for giving the solution for these two questions I hope you like this video I hope at least it would be helpful for few and if you are on our channel for the first time you can visit our channel and you can see these are the number of videos that we have already shared you can find a lot of interview experiences that we have already shared this is for the first time visitors you can visit our channel you can get benefit out of all the videos this will definitely help and we usually we get a lot of emails and comments on the different videos that these are helpful so with that perspective I'm saying that this will definitely help you as well so if at all you want to contribute us you can reach us out at the email id which is present here you can mail us out you're all your queries that will be if it all we can answer them we will definitely answer it if at all you want to contribute us anything you can open any one of our video and below the video we have Amazon affiliation link using this link if it all you are buying something then there are chances that we might get some commission out of the amount that you are spending on amazon so if you want you if it's up to you you can help us out here as well and if you haven't subscribed us yet please do subscribe building the subscribe button and all the best for your further interviews and thank you for watching