Sister, for Q2. common in two Array, the output is not correct if elements are not distinct in array1. so I think need to add: distinct() as well. Now output correct: public class Intersection { public static void main(String[] args) { int[] arr1 = {1,2,3,4,4,5}; int[] arr2 = {4, 4,5,6, 7}; findIntersection(arr1, arr2); } public static void findIntersection(int[] arr1, int[] arr2){ List intersection = Arrays.stream(arr1).distinct().filter(i-> Arrays.stream(arr2).anyMatch(j-> j == i)).boxed().toList(); System.out.println(intersection); } }
@CodeDecode Жыл бұрын
Correct Raushan 👍👍 that edge case scenario is left to be covered like we did in first question 👏👏
@Crazy777727 күн бұрын
I feel like for the 1st questions we can approach as below if you are a beginner like me: I personally feel the below approach is more logic oriented as it can be understood by anyone and isn't as confusing as shown in video as the video uses so many inbuilt methods. I just learned array yesterday and felt happy for being able to solve it completely by myself haha. Please do suggest me if there's more simpler methods and logical than this one. In the below program, I simply found the smallest array and then again run a loop which neglects the smallest array and goes on to look for another small number. public class Ques { public static void main(String[] args) { // Finding second smallest array int []a= {-100,-20,80,60}; int min1=Integer.MAX_VALUE; int min2=Integer.MAX_VALUE; for(int i=0;i
@nishantdeep3973 Жыл бұрын
Hey mam... started learning Java 8 6 months ago from ur given playlist as a beginner and now cracking multiple coding rounds in MNCs. Thanx a lot for that, I have one query if u can pls include in next video - the approach that u have used in reverse array via forEach(Consumer Interface) ,how can we done same for checking integerPalindrome via filter( Predicate).
@CodeDecode Жыл бұрын
Many many congratulations Nishant for cracking interviews 🎉🎉🎉🎉 well done Man keep learning keep shining 🌟🌟. Sure👍👍
@BlueBird-yg4po10 ай бұрын
Where can I find interview
@argonechaks9850 Жыл бұрын
Yes we need more such questions covered
@CodeDecode Жыл бұрын
Sure 😊👍
@mohanvs-msv Жыл бұрын
@@CodeDecodeYes we need more problems like this...!!
@FBHI3 ай бұрын
wow the first one, I would only sort the array and do a "arr[1]" as an answer, but using stream gives a nice touch to it!!
@deepalimalviya63877 ай бұрын
Thanks for creating such videos, would you please create a video continuation of this? This will be very helpful.
@punitsakre4608 Жыл бұрын
Answer for Last Question: int[] numbers = {2, 4, 6, 8}; int except = 4; int res = Arrays.stream(numbers).filter(n -> n != except).reduce(1, (n1, n2) -> n1 * n2); System.out.println(res);
@vikasrai4915Ай бұрын
Very nice explaination, I finished the whole playlist in 2 days, meanwhile I was wondering whether I can get the notes and code shown in the videos, it would be really helpful, I have some interviews, will need that for revision. Thanks
@kumudgoel652011 ай бұрын
thank you mam, the way of explaining is very superb
@CodeDecode11 ай бұрын
You are welcome
@bhoslegovind964411 ай бұрын
Thanks mam for provides us such a important content..We will waiting for next part of that video 🤗🎉
@CodeDecode11 ай бұрын
👍😊
@KrishnaveniNakanamoni Жыл бұрын
I love ur explanation....thank u very much mam... U r helping people like me to rock the interview also To understand the concepts... Clear explanation... Nice voice... Too good.... first time viewing ur Vedios also subscribed 😊😊
@CodeDecode11 ай бұрын
Thanks Krishna 😊
@DushmantaKSahu3 ай бұрын
reverse a list--- List arr=Arrays.asList(1,2,3,4,5); arr.stream().collect(Collectors.toCollection(LinkedList::new)).descendingIterator().forEachRemaining(System.out::println);
@rushisharma1222 Жыл бұрын
It is nice topic are covered on java 8 features 😊
@CodeDecode Жыл бұрын
Thanks Rushi 🙂
@ajeetola7153 ай бұрын
firts time viewing your vedio best helpfull vedio mam ....i subscribed and like .....and heartly thanku mam
@CodeDecode3 ай бұрын
Thanks Ajeet 😊
@supriya012910 ай бұрын
Instead of using available functions explain with logic because HRs only asks for logic
@bhalulal5947 Жыл бұрын
Love you for this video 👌👌👌 what a video 👌👌 waiting for next part
@CodeDecode Жыл бұрын
Sure 😊😊
@sivakrishna1994 Жыл бұрын
Really so useful ...ur videos r awesome..pls make some professional java courses olayilisy
@CodeDecode Жыл бұрын
Soon 🙂🙂
@IndeedShiksha_withotherstuffsАй бұрын
Thanks alot Mam, could you plz create it's next part covering more such questions?
@nikunjkheni8503 Жыл бұрын
Nice questions and its solution. Keep up creating videos !
@CodeDecode Жыл бұрын
sure nikunj we will create more like this
@buddha768Ай бұрын
Thank you for making such good video on java8. Can you please write java program on java 8? Find the length of the longest substring with all distinct characters
@ravindrasiddavatam10975 күн бұрын
Good content
@CodeDecode4 күн бұрын
Thanks
@MohitKhare11 ай бұрын
Always a big fan. Thanks.
@CodeDecode11 ай бұрын
❤️❤️
@tiituma5 ай бұрын
Thanks a lot
@CodeDecode5 ай бұрын
Most welcome
@poonamkale588210 ай бұрын
Love to watch ur content. It will be more helpful if u provide ur source code for same
@sharadsingh2856 Жыл бұрын
Very useful thanks
@CodeDecode Жыл бұрын
Thanks
@mrrishiraj88 Жыл бұрын
Thanks
@annajiraoannepu27183 ай бұрын
good explanation.
@CodeDecode3 ай бұрын
Thanks 😊👍
@shrutik1863 Жыл бұрын
Awesome, waiting for next vh ideo
@CodeDecode Жыл бұрын
sure we will upload it soon
@boxofgames3 Жыл бұрын
Your explanation is always awesome mam.. keep rock
@CodeDecode Жыл бұрын
Thanks 🙂👍
@Sigma-Coding-dm3it8 ай бұрын
great job maam
@CodeDecode8 ай бұрын
Thanks 👍👍
@ishankotru7652 Жыл бұрын
Absolutely magnificent
@CodeDecode Жыл бұрын
Thanks 🙂👍
@ishankotru7652 Жыл бұрын
@@CodeDecode will you plz try some complex problems in data structures
@deepa817710 ай бұрын
Informative Java 8 Interview Series, thanku, mam I think this one is the last video of this Series, not able to find the videos of last 2 questions of this current video.. 1) Remove duplicates preserving order. 2) Product of all elements except current element. Please make video on this if not made because ur logic & explanations really open ups the mind to think in different approach. thanku mam
@start1learn-n1717 ай бұрын
Tq
@CodeDecode7 ай бұрын
😊👍
@sameer9368 Жыл бұрын
Great🎉
@CodeDecode Жыл бұрын
Thanks Sameer 👍🙂
@paridadeepika Жыл бұрын
Thank u so much for sharing such videos..
@CodeDecode Жыл бұрын
🙂👍
@akashsaha9366 Жыл бұрын
Great video
@CodeDecode Жыл бұрын
Thanks Akash 🙂🙂
@jskr456 Жыл бұрын
well explained
@CodeDecode Жыл бұрын
Thanks
@nivaschintu8850Ай бұрын
It's better if you solve them without inbuilt methods As beginning cannot understand the methods directly
@subhrajitsaha233 Жыл бұрын
Please upload more videos on stream
@CodeDecode Жыл бұрын
Sure we will upload it soon
@nikitasarda7389 Жыл бұрын
We need many more questions
@CodeDecode Жыл бұрын
Sure we will cover it soon
@harshitsachdeva4836 Жыл бұрын
Bring more videos for this
@CodeDecode Жыл бұрын
Sure we will create it soon
@mohammedraza4846Ай бұрын
Nome of the interviewer will ask you to use pre defined Classes and methods, you need to write the logic specially for freshers
@kudumulasivaramakrishnared6379 Жыл бұрын
hi, can u please do a video on HashMap custom key ?
@robinbhargava111 Жыл бұрын
Indori Rocks !!!
@CodeDecode Жыл бұрын
👍👍
@arpit1145 Жыл бұрын
We can using distinct to remove duplicates.
@CodeDecode Жыл бұрын
Multiple multiple ways of doing same thing Arpit 👍👍
@akashtanajigurav82265 ай бұрын
1 Question ] Answer package z_pracxtice; public class xyzz { public static void main(String[] args) { int arr1[]= {10, 20, 30, 40, 50,50}; int big =0; int sm=0; for(int i=0;i
@aashishjadhav4415 Жыл бұрын
We can solve this problem using Max heap
@CodeDecode Жыл бұрын
👍👍
@ajitdighe3293 Жыл бұрын
When will the next video be posted arrays programming?
@CodeDecode11 ай бұрын
Soon Ajit 👍👍
@user-ur8fy9ef1z Жыл бұрын
Hi, Do you have any video how to debug the program in Java streams? Example: I do operation on stream then filter and then collect to a list.. if there are 1000 records and seems my 40th record is not filtering properly. How can i debug in eclipse with out using peek and in normal debug mode.. because usually we work with objects like employee and want to check either name or id or some other details of it. Can you please create a video for this or if you have any explanation, can you please let know.. looking forward for your response
@user-ur8fy9ef1z Жыл бұрын
For example, in the method reverseGivenArrayInPlace, in the foreach intermediate operator, if developer would like to check the values for i=2, then how can he peek there (not exactly peek, stop the running and check values there)? Finally, you do making great videos for the developer community. Thank you!!
@rishiraj2548 Жыл бұрын
🙏👍💯
@CodeDecode Жыл бұрын
😊😊
@rishiraj2548 Жыл бұрын
@@CodeDecode 👍
@gowrisankar217710 ай бұрын
Hi please provide remaining array questions
@CodeDecode10 ай бұрын
Sure 👍
@takber92 Жыл бұрын
The approach to Q1 is not the best. Sorting is expensive than searching so a linear search is much better to use.
@ramprasath4788 Жыл бұрын
liked commets
@CodeDecode Жыл бұрын
Thanks Ram 🙂👍
@anilrouto4513 Жыл бұрын
When can we expect the next video ???
@jagrutipatil1020 Жыл бұрын
👍☺️
@CodeDecode Жыл бұрын
🙂
@parteeksethi1428 Жыл бұрын
Last question Answere: int[] arr = {2, 3, 4, 5}; int[] ints = Arrays.stream(arr). map(i -> Arrays.stream(arr).filter(j -> j != i).reduce(1, (a, b) -> a * b)).toArray();
@inzi27 Жыл бұрын
breaks when there are duplicate elements
@akshayjawale13729 ай бұрын
how to solve this?@@inzi27
@sureshmanne7245 Жыл бұрын
String[] strings = {"Banana","Apricot","Apple","Strawberry","Mango","Pineapple"}; int maxLength = Arrays.stream(strings).mapToInt(string -> strings.length).max().orElse(0); System.out.println("Length of longest string:" +maxLength); Can you check this one, I'm getting wrong output of 6 instead of 10
@AshokNarayana-jr2wt Жыл бұрын
yeah same for me also...but using method reference worked for me int max=Arrays.stream(items).mapToInt(String ::length).max().orElse(0); try these one
@AshokKumar-ml5pn Жыл бұрын
int maxLength = Arrays.stream(strings).mapToInt(string -> string.length()).max().orElse(0);
@AshokKumar-ml5pn Жыл бұрын
Check int maxLength line once
@CodeDecode Жыл бұрын
Can you check string -> strings.length . It should be string.length (not with an s)
@CodeDecode Жыл бұрын
That's because the line where method reference is used, there Suresh has written wrong code. He is mapping string with arrays.length and not string.length. He is doing strings.length not string.length. Hence wrong answer
@chintu06910 ай бұрын
@Srikanth-mp2li4 ай бұрын
Audio not clear
@eminentAp7 ай бұрын
Questions with timing :- Q1 - Given an array of integers, write a java8 program to find the second smallest element - 0:33 Q2 - Given two arrays of integers, write a java8 program to find the common elements between them - 6:31 Q3 - Write a java8 program to reverse an array of integers in-place - 14:02 Q4 - Given an array of strings, write a java8 program to find the length of the longest string - 18:59
@rajnikantyadav12984 ай бұрын
This is not for beginners 😅😅 and we can use more simple ways to solve these problems.
@Oscar-zu3lo Жыл бұрын
Promo'SM ✅
@sarojsahoo8763 Жыл бұрын
String[] str = new String[]{"Apple","Banana","Apple","Grapes","Banana"}; List stringList = Arrays.stream(str) .collect(Collectors.groupingBy(s -> s, Collectors.counting())) .entrySet().stream() .filter(entry -> entry.getValue() < 2) .map(Map.Entry::getKey) .collect(Collectors.toList()); System.out.println(stringList);//removing duplicates while preserving original order