Java Program to find common elements from two arrays

Поділитися
Вставка
  • Опубліковано 2 жов 2024
  • This video contains java programming questions along with solution.
    One of the best book for Interview Questions
    Top 1000 Java Interview Questions & Answers: Includes Spring, Hibernate, Microservices, GIT, Maven, JSP, AWS, Cloud Computing @ amzn.to/32zFihe
    Best Laptops : amzn.to/33rBT4A
    Best Software's : amzn.to/3h9TTbw
    📌 Do Subscribe for all Updates.
    Telegram : Drunken Engineer
    t.me/DrunkenEn...
    You can follow us on Facebook :
    / drunkenengineer8
    Feel free share your Interview Experience with us @ funnytechiees@gmail.com
    #javacodingquestions #interviewquestionsandanswers #interviewpreparation
    java coding questions,
    java coding interview questions,
    java programming interview questions,
    java interview questions for experienced

КОМЕНТАРІ • 13

  • @nagarajus8098
    @nagarajus8098 Рік тому +3

    We can get both union and intersection with two for loops:
    String arr1[]= {"java","interview","questions","for","experienced"};
    String arr2[]= {"java","fresher","interview","questions"};

    Set set=new HashSet();
    for(int i=0;i

  • @girishrp9339
    @girishrp9339 15 днів тому

    Why did stop uploading new videos since one year. Please upload other product based companies java interview

  • @ramanareddysagili3626
    @ramanareddysagili3626 Рік тому +1

    Immediate question what is the time complexity from interviewer 😮

  • @Amarsri19
    @Amarsri19 7 місяців тому

    String[] s1 = {"java","python","aws"};
    String[] s2 = {"java","perl","aws"};
    Arrays.stream(s2)
    .filter(Arrays.asList(s1)::contains)
    .forEach(str -> System.out.print(str + " "));
    output: java aws

  • @SahanasAllinOneChannel
    @SahanasAllinOneChannel 7 місяців тому

    String[] s1 = {"java","python","aws"};
    String[] s2 = {"java","perl","aws"};

    for(String s:Arrays.asList(s1)) {
    if(Arrays.asList(s2).contains(s)) {
    System.out.println(s);
    }
    }

  • @janagamasainath
    @janagamasainath 5 місяців тому

    using java 8 one way to find the common String
    String[] a = {"java","python","hibernate", "spring"};
    String[] b= {"core","java","spring","microservices"};
    List a1 = Arrays.asList(a);
    List b1 = Arrays.asList(b);
    List collect = a1.stream().filter(b1::contains).collect(Collectors.toList());
    System.out.println(collect);

  • @aw703
    @aw703 8 місяців тому

    Sir, it is been a long time we have been waiting for the video. Please help us in getting the job

  • @humptydumpty4527
    @humptydumpty4527 Рік тому +1

    👍

  • @sushilroy22
    @sushilroy22 Рік тому

    Bhai new interview video waiting. It’s help to learn

  • @Sarath-n9b
    @Sarath-n9b Рік тому

    Looking for your interviews...

  • @Sarath-n9b
    @Sarath-n9b Рік тому

    No video since last 7 months

  • @raviravi-gg5ck
    @raviravi-gg5ck 8 місяців тому

    Alternate way using java 8:
    String[] fruit1 = {"apple", "mango", "banana", "papaya", "apple", "mango", "banana"};

    String[] fruit2 = {"apple", "grape", "banana", "orange"};

    Stream f1 = Arrays.stream(fruit1);
    Stream f2 = Arrays.stream(fruit2);


    Map groupString = list.stream().collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));
    groupString .entrySet().stream().filter(e -> e.getValue()>1).map(e -> e.getKey()).forEach(System.out::println);