Java 8 Streams programs you must prepare for Java Interviews

แชร์
ฝัง
  • เผยแพร่เมื่อ 27 ม.ค. 2021
  • Below are the frequently asked programs during the coding round in java interviews. In this video, I explain the below programs in detail.
    Please make sure, you prepare well for the below programs.
    1.Write a program to print employee details working in each department
    2.Write a program to print employees count working in each department
    3.Write a program to print active and inactive employees in the given collection
    4.Write a program to print Max/Min employee salary from the given collection
    5.Write a program to print the max salary of an employee from each department

ความคิดเห็น • 77

  • @SandeepKumar-se2fd
    @SandeepKumar-se2fd 2 ปีที่แล้ว +1

    Great and wonderful example for Stream API.... Great!!!!!

  • @InterviewDOT
    @InterviewDOT 3 ปีที่แล้ว +1

    Very nice thanks for sharing 👌🙏

  • @venkatsam2472
    @venkatsam2472 3 ปีที่แล้ว +7

    Wonderful explanation with example. Thank you so much. Will be waiting to see more videos.. 👏🏻👌🏻🙏🏻👍

    • @javatech8530
      @javatech8530 2 ปีที่แล้ว

      HCL Technologies Technical Round | 5+ Years Virtual Interview | Java Developers
      th-cam.com/video/WmxlNpEfL04/w-d-xo.html

  • @lakshmidevilakshmidevi3984
    @lakshmidevilakshmidevi3984 9 หลายเดือนก่อน

    Thank you for sharing your knowledge with us Sir

  • @venkatesha6378
    @venkatesha6378 9 หลายเดือนก่อน

    super siva , good keep it up. its 13 years since we met.

  • @JameS00989
    @JameS00989 2 ปีที่แล้ว +1

    Amazing video Shiva much appreciated

  • @SuccessToSamadhi
    @SuccessToSamadhi ปีที่แล้ว

    excellent sir.. Thank you

  • @mamatharao2127
    @mamatharao2127 2 ปีที่แล้ว

    Excellent

  • @Vithal_Nivargi
    @Vithal_Nivargi ปีที่แล้ว +1

    Thank you please make one more video on Java8 coding questions

  • @deepa8177
    @deepa8177 5 หลายเดือนก่อน

    great video specially quetsion no 5.

  • @anandpadamala3586
    @anandpadamala3586 3 ปีที่แล้ว

    Nice sir 👌

  • @DMvali
    @DMvali 2 ปีที่แล้ว +1

    Thanks siva!

  • @maheshuma741
    @maheshuma741 2 ปีที่แล้ว +4

    To calculate dept wise statistics like min,max,average we can use following code : empList.stream.collect(Collectors.groupingBy(Employee::getDeptId, Collectors. summarizingDouble(Employee::getSal))) ; it returns Map . Just for knowledge purpose sharing my thoughts.. Don't take it in another way.

    • @deepa8177
      @deepa8177 5 หลายเดือนก่อน

      thanks fro sharing..

  • @riteshchiddarwar9881
    @riteshchiddarwar9881 3 ปีที่แล้ว +1

    @siva, its very useful for quick review of java 8 streams. Very nice example you taken and explained . 👍 very best and helpful.

    • @javatech8530
      @javatech8530 2 ปีที่แล้ว

      HCL Technologies Technical Round | 5+ Years Virtual Interview | Java Developers
      th-cam.com/video/WmxlNpEfL04/w-d-xo.html

  • @chetandy2573
    @chetandy2573 3 ปีที่แล้ว +2

    Thanks sir, very nicely explained

    • @javatech8530
      @javatech8530 2 ปีที่แล้ว

      HCL Technologies Technical Round | 5+ Years Virtual Interview | Java Developers
      th-cam.com/video/WmxlNpEfL04/w-d-xo.html

    • @javatech8530
      @javatech8530 2 ปีที่แล้ว

      HCL Technologies Technical Round | 5+ Years Virtual Interview | Java Developers
      th-cam.com/video/WmxlNpEfL04/w-d-xo.html

  • @adityapratapsingh7311
    @adityapratapsingh7311 3 ปีที่แล้ว +1

    Very helpful videos,make more such java8 programming videos....thanks a lot sir

    • @javatech8530
      @javatech8530 2 ปีที่แล้ว

      HCL Technologies Technical Round | 5+ Years Virtual Interview | Java Developers
      th-cam.com/video/WmxlNpEfL04/w-d-xo.html

  • @zuberdiwan8123
    @zuberdiwan8123 ปีที่แล้ว +1

    Very Nice Video. very well Explained. Thank You.......

  • @maheshuma741
    @maheshuma741 2 ปีที่แล้ว

    Thank you sir for making this video. . To get active and Inactive works in a single Iteration we can use partitionBy() method. Sample Code : employeeList.stream().collect( Collectors.partitioningBy(emp->"active".equalsIgnoreCase(emp.getName())) , It returns Map . At the calling place map.get(true) for active and map.get(false) for inactive.. We have n number of ways it is the one of the way.

    • @kshitijbansal3672
      @kshitijbansal3672 ปีที่แล้ว

      Can we do like this also?
      List.stream(). collect (Collectors.groupingBy(Employee: getStatus(), Collectors.counting());
      It will first group by on basis of Active and Inactive and then count it.

  • @maheshd3506
    @maheshd3506 2 ปีที่แล้ว +1

    clear explanation and thanks

  • @thebaseofpcmbclasses8028
    @thebaseofpcmbclasses8028 ปีที่แล้ว

    nice explanation sir

  • @srinivass5552
    @srinivass5552 3 ปีที่แล้ว

    Thanks sir very useful

    • @javatech8530
      @javatech8530 2 ปีที่แล้ว

      HCL Technologies Technical Round | 5+ Years Virtual Interview | Java Developers
      th-cam.com/video/WmxlNpEfL04/w-d-xo.html

  • @start1learn-n171
    @start1learn-n171 4 หลายเดือนก่อน

    Tq

  • @kemparaj565
    @kemparaj565 2 ปีที่แล้ว +3

    Amazing explanation. Thank You 😊. Could have formatted the code. Few parts of code is missing.

  • @poojas1600
    @poojas1600 ปีที่แล้ว +1

    Excellent video

  • @abhishekjain6559
    @abhishekjain6559 2 ปีที่แล้ว +1

    Nice video.. very nicely explain.. Can you please explain the reducing function example.

  • @local-host80-80
    @local-host80-80 3 ปีที่แล้ว +1

    thanks

    • @SivaReddyJavaTechie
      @SivaReddyJavaTechie  3 ปีที่แล้ว

      Thanks Nagesh. Please refer our TH-cam Channel to your friends and colleagues as it may helpful for them. Happy learning.

  • @muchukundareddy5315
    @muchukundareddy5315 ปีที่แล้ว

    Hi Siva, I tried Lambda expression as input for "Comparator.comparing" It was not working

  • @bacchaparty6275
    @bacchaparty6275 3 ปีที่แล้ว +1

    U r brilliant sir

    • @SivaReddyJavaTechie
      @SivaReddyJavaTechie  3 ปีที่แล้ว +1

      Thanks Amit. Please share our TH-cam channel to your friends circle as it may be helpful for them. Happy Learning.

    • @bacchaparty6275
      @bacchaparty6275 3 ปีที่แล้ว +1

      @@SivaReddyJavaTechie Sure Sir

    • @javatech8530
      @javatech8530 2 ปีที่แล้ว

      HCL Technologies Technical Round | 5+ Years Virtual Interview | Java Developers
      th-cam.com/video/WmxlNpEfL04/w-d-xo.html

  • @Proman.Offbeat.Traveller
    @Proman.Offbeat.Traveller ปีที่แล้ว

    NYC information 22:33

  • @rajuls6101
    @rajuls6101 2 ปีที่แล้ว +1

    Sir can you answer this select employee where department is technology and location not equal to mumbai..

    • @ShinAkuma
      @ShinAkuma 2 ปีที่แล้ว

      filter( e -> "technology".equals(e.getTechnology()) && !( "mumbai".equals(e.getCity()) ) )

  • @indranildas8485
    @indranildas8485 ปีที่แล้ว

    what is the name of the background music?

  • @dharamkirti24
    @dharamkirti24 2 ปีที่แล้ว

    Sir a git hub link would have been helpful

  • @enlightened7354
    @enlightened7354 ปีที่แล้ว

    Filter?

  • @vikrantharne5269
    @vikrantharne5269 3 ปีที่แล้ว +1

    Sir outer joins practice questions plz..scenario based

    • @SivaReddyJavaTechie
      @SivaReddyJavaTechie  3 ปีที่แล้ว

      Sure. I will upload soon.

    • @vikrantharne5269
      @vikrantharne5269 3 ปีที่แล้ว

      @@SivaReddyJavaTechie waiting..I'm still confused abt tht topic...

    • @SivaReddyJavaTechie
      @SivaReddyJavaTechie  3 ปีที่แล้ว +1

      Sure. I will upload video on the requested topic as soon as possible

    • @javatech8530
      @javatech8530 2 ปีที่แล้ว

      HCL Technologies Technical Round | 5+ Years Virtual Interview | Java Developers
      th-cam.com/video/WmxlNpEfL04/w-d-xo.html

  • @pratapjavasingh3239
    @pratapjavasingh3239 3 ปีที่แล้ว +8

    I can request u sir whenever u writing the codes then atleast first explain predefined method apart from that then u can write the code it's request 🙏

    • @SivaReddyJavaTechie
      @SivaReddyJavaTechie  3 ปีที่แล้ว +5

      Hi Pratap, Good suggestion. I make a note of it and will do same for future videos.

    • @pratapjavasingh3239
      @pratapjavasingh3239 3 ปีที่แล้ว

      @@SivaReddyJavaTechie Thank you 🙏

    • @javatech8530
      @javatech8530 2 ปีที่แล้ว

      HCL Technologies Technical Round | 5+ Years Virtual Interview | Java Developers
      th-cam.com/video/WmxlNpEfL04/w-d-xo.html

  • @CodeUpskill
    @CodeUpskill 2 ปีที่แล้ว

    hi siva,
    can u give code github url?

    • @javatech8530
      @javatech8530 2 ปีที่แล้ว

      HCL Technologies Technical Round | 5+ Years Virtual Interview | Java Developers
      th-cam.com/video/WmxlNpEfL04/w-d-xo.html

  • @chinnimounika8645
    @chinnimounika8645 2 ปีที่แล้ว

    Sir can you help me to slove my assignment programs in Java

  • @knowledgeshare1622
    @knowledgeshare1622 ปีที่แล้ว

    how to find sum of the salary of each department????

    • @jeckrazi7691
      @jeckrazi7691 ปีที่แล้ว

      Map mapEmpDept = empList.stream().collect(Collectors.groupingBy(Employee::getDept, Collectors.summarizingInt(Employee::getSalary)));
      mapEmpDept.entrySet().forEach(entry -> System.out.println("Dept:: " + entry.getKey() + " & Sum:: " + entry.getValue().getMin()));

  • @errahulrajocjp
    @errahulrajocjp 2 ปีที่แล้ว

    Hello Sir ! Thank you for explanation. Q 5) Dept 103 having two employee having same salary 3500, but showing only one employee as a result ?

    • @javatech8530
      @javatech8530 2 ปีที่แล้ว

      HCL Technologies Technical Round | 5+ Years Virtual Interview | Java Developers
      th-cam.com/video/WmxlNpEfL04/w-d-xo.html

  • @morning8474
    @morning8474 3 ปีที่แล้ว

    sir plz upload hai video where u would teach run time question only.............Request by your suscriber

    • @SivaReddyJavaTechie
      @SivaReddyJavaTechie  3 ปีที่แล้ว

      The intention is to emphasis on the importance of these programs so that viewers can pay more attention to prepare for the same and will get benefit in the interview.

    • @javatech8530
      @javatech8530 2 ปีที่แล้ว

      HCL Technologies Technical Round | 5+ Years Virtual Interview | Java Developers
      th-cam.com/video/WmxlNpEfL04/w-d-xo.html

  • @gottepavani1838
    @gottepavani1838 ปีที่แล้ว

    Sir how to get second max salary

    • @jeckrazi7691
      @jeckrazi7691 ปีที่แล้ว

      //Second Minimum Salary
      empList.stream().sorted(Comparator.comparing(Employee::getEmpSalary)).skip(1).limit(1).forEach(System.out::println);
      //Second Maximum Salary
      myEmployee_Demo.stream().sorted((e1,e2)-> (e1.getEmpSalary() < e2.getEmpSalary()) ? 1 : ((e1.getEmpSalary() == e2.getEmpSalary()) ? 0 : -1)).skip(1).limit(1).forEach(System.out::println);

  • @palanirajkumar4904
    @palanirajkumar4904 3 ปีที่แล้ว

    sir send the code

    • @javatech8530
      @javatech8530 2 ปีที่แล้ว

      HCL Technologies Technical Round | 5+ Years Virtual Interview | Java Developers
      th-cam.com/video/WmxlNpEfL04/w-d-xo.html

  • @coincidentIndia
    @coincidentIndia 2 ปีที่แล้ว

    why using reducing ? we can directly use the maxBy on groupBy DepartmentId. Map maxSalaryByDept = employeeList.stream().collect(Collectors.groupingBy(Employee::getEmployeeDepartmentId, Collectors.maxBy(Comparator.comparing(Employee::getSalary))));
    maxSalaryByDept.forEach((k,v)->{System.out.println("Dept "+k+" Salary "+v);});