Java Collection Interview Questions & Answers | Tricky Q&A | Freshers | Experience | JavaTechie

Поделиться
HTML-код
  • Опубликовано: 4 окт 2024
  • In this tutorial we will discuss Java Collection frameworks frequently asked interview questions and answers with Example , all the topics we will cover in upcoming tutorial
    #javatechie #CoreJava #Interview #QA #Collection
    GitHub:
    github.com/Jav...
    Blogs:
    / javatechie4u
    Facebook:
    / 919464521471923
    guys if you like this video please do subscribe now and press the bell icon to not miss any update from Java Techie
    Disclaimer/Policy:
    --------------------------------
    Note : All uploaded content in this channel is mine and its not copied from any community , you are free to use source code from above mentioned GitHub account

Комментарии • 237

  • @krishnakarthik7198
    @krishnakarthik7198 2 года назад +24

    I've been on a streak watching your tutorials for my interview prep, you are really helping a lot in quickly brushing up and also learning new concepts. More power to you...!!

  • @nandinimani7084
    @nandinimani7084 3 года назад +11

    Just completed watching 😊. Whoever reading the comments section, pls watch his interview question collections videos without having second thought. You will get many questions in interview for sure. Sharing this with my personal interview experience.

    • @Javatechie
      @Javatechie  3 года назад +2

      Thanks Nandni

    • @OracleLand_Official
      @OracleLand_Official 3 года назад

      Watch full collections interview questions here part 10 to 15.....

  • @vivekkewalramani2736
    @vivekkewalramani2736 3 года назад +9

    this video covered all the key questions asked in interview. Please create these interview questions video more oftenly.

  • @abhishekgowlikar
    @abhishekgowlikar 9 месяцев назад +4

    Everyone need this whether fresher or experience, Good Work and Content.

  • @sreddy8141
    @sreddy8141 3 года назад +38

    Basant sir, please start series on data structures and algorithm, its a humble request. Please

  • @ILuvBilli
    @ILuvBilli 2 года назад +1

    hi basant, just adding one thing here, if we use java 8 then no need to write custom code for sorting , checking multiple values,
    System.out.println("");
    System.out.println("name and salary basis in java 8");
    Collections.sort(list, Comparator.comparing(Employee::getName).thenComparing(Employee::getSalary));
    for (Employee e : list) {
    System.out.println(e);
    }
    checking one value,
    System.out.println("salary basis using stream");
    list.stream().sorted(Comparator.comparing(e -> e.getSalary())).forEach(System.out::println);

  • @jagdishkamadi
    @jagdishkamadi 2 месяца назад +1

    @Basant Sir, thank you for providing such an in-depth explanation in simple ways.

  • @rabindrapatra7151
    @rabindrapatra7151 3 года назад +1

    57:53 we are just seeing treemap linearly. but it is not the actual way. treemap entry looks like below: static final class Entry implements Map.Entry {
    K key;
    V value;
    Entry left;
    Entry right;
    Entry parent;
    boolean color = BLACK;
    } what is color black here, what does left,right,parent doing.

  • @hanumansays3725
    @hanumansays3725 2 года назад +7

    One of the best interview videos ever seen for Java.
    Excellent job. Thank you.

  • @abhijitprusty
    @abhijitprusty 3 года назад +11

    It would nice help if you could make some video related to DSA which are mostly asked during the interview for all kind of technical postions in Java.

  • @namjitharavind
    @namjitharavind 6 месяцев назад +1

    Thanks for the video. Concurrent HahMap is not Synchronised. ConcurrentHashMap in Java is indeed thread-safe, but it achieves this without using traditional synchronization mechanisms like locks. Instead, it uses a different approach called "lock-striping" and "compare-and-swap" operations to allow concurrent access from multiple threads without blocking them unnecessarily.

  • @santoshkamat6132
    @santoshkamat6132 2 года назад +4

    Great tutorial brother. But i believe, for normal hashmap lock will not be applied on whole collection. Lock will be applied on whole collection in synchronised hashmap . And as u rightly said segment wise locking in concurrent hashmap
    Anyways you doing a great job with interview playlist in helping so many IT people get jobs during this boom😄

  • @Kunalsumanblogs
    @Kunalsumanblogs 2 года назад +2

    Thanks allot for clear explanation ..I have gone through your and Durgesh sir video's ...And I am very confident about comming interview...

  • @AbheyKhurana-tc6be
    @AbheyKhurana-tc6be 16 дней назад +1

    Why are you so underrated , the content is just so professional and to the point, I Wish that you get more views and likes for your ahead uploads

    • @Javatechie
      @Javatechie  16 дней назад

      Thank you buddy for well wish 🤞

  • @bhawnarastogi1869
    @bhawnarastogi1869 3 года назад +2

    So far the best and crisp, as it's not just tells theory..it's with example. Great job 👍

  • @karthibaby7766
    @karthibaby7766 3 года назад +18

    Hi basant , great content could you please post Q&A for spring and spring MVC and boot all together with the practical example , it would be more helpful candidates like me .. thanks

    • @007tushard
      @007tushard 3 года назад +2

      Microsevice also

    • @Hacks00145
      @Hacks00145 3 года назад +1

      Yes sir..
      Would be helpful

    • @Javatechie
      @Javatechie  3 года назад +1

      Tusar and hacks I will do this .after saga pattern video

  • @mubeenkazi
    @mubeenkazi 2 года назад +1

    most beneficial video, all concepts cleared. Will surely recommend

  • @arunprasad8261
    @arunprasad8261 11 месяцев назад +1

    Thanks Sir.. Very much helpful in preparation.. Concepts are quite clear and proven

  • @SairamDasari2000
    @SairamDasari2000 2 месяца назад +1

    Thankyou so much for the video brother learnt a lot , in tree map internal implementation would be binary search tree i think.

  • @satyamkumar-qc1mr
    @satyamkumar-qc1mr 2 года назад +6

    I generally do not comment on any youtube videos...but this tutorial is so good that i cracked 10+ interviews in just a shorter span of 1 month and got hike of more than 150%.Thanks a lot..and keep uploading such videos for iinterview preparation.

    • @Javatechie
      @Javatechie  2 года назад

      Thanks buddy 😀. Glad to know this

  • @Kishore_327
    @Kishore_327 Год назад +1

    very very very nice and helpful interview questions .In no other videos i have seen this good content .this helped me a lot in my interviews.

  • @debroy1
    @debroy1 2 года назад +1

    Hello, in CopyOnWriteArrayList - can you print the elements again at the end after coming out of while loop as System.out.println(list); That should print the elements in the list including new elements added at the end from the copied list newly created.
    Another point here is, the iterator supports to delete an element using remove() in case of an ArrayList, though it does not support to add any new element to that. I believe remove() also works in similar concept - creates another copy of original list.

  • @channabasavav1823
    @channabasavav1823 2 года назад +1

    Thank you so much , it is a much needed videos for all job seekers 🙏🙏🙏🙏

  • @AnilKumar-dt3sq
    @AnilKumar-dt3sq 2 года назад +2

    Basant Sir, first of all, I have no words to thank you. You are really doing a great job by sharing this invaluable knowledge and experience with us. However, one small doubt - if Set uses Wrapper class like String, Integer it doesn't allow duplicates. Only for custom classes we need to override equals() & hashcode().

    • @Javatechie
      @Javatechie  2 года назад

      Yes that's correct because all wrapper classes by default override equals and hashcode method

  • @sibasisdash3984
    @sibasisdash3984 2 года назад +1

    Sir your teaching is vary helpful ,, videos are very important.
    Please make one single video on spring boot interview questions.

  • @suryajena1575
    @suryajena1575 2 года назад +2

    Appreciate your efforts , thanks for the good job, invaluable contribution to the community.

  • @bharatiyaashish
    @bharatiyaashish 3 года назад +2

    This was ultimately awesome👏✊👍
    Thanks a lot🙏🙇
    Waiting 4 nxt vdo...😊🇮🇳🙏🌻👏👏👌👌

  • @RussianCyclop
    @RussianCyclop 2 года назад +1

    Great tutorial on Collections Framework interview questions, very informative, thank you!

  • @yourskishore5790
    @yourskishore5790 3 года назад +2

    Really love you sir...got few offers due to your valuable teaching 😍😍

  • @GOPINATH-xb3im
    @GOPINATH-xb3im 2 года назад +1

    First i thought this is going to be the same as always like difference this with this & difference this with that blah blah sh*t, but I'll say this is best Q&A ever of collection. Thank you sir

  • @NareshKumarD107
    @NareshKumarD107 2 года назад +1

    Thank you so much.
    Very helpful. Pls make more this type vdos on spring,springboot,jpa,hibernate etc

  • @preethisubramani4817
    @preethisubramani4817 2 года назад +1

    Good job !! Ur video helped to understand quickly about collections 👍

  • @kavithareddy6998
    @kavithareddy6998 3 года назад +3

    Hi basant, could you please create videos on multithreading and executor framework with examples.

  • @dedeepyaamasa4441
    @dedeepyaamasa4441 2 года назад +2

    very clearly explained,waiting for more in this series

  • @aditipai7289
    @aditipai7289 3 года назад +1

    Well explained. I especially liked the Hashmap explanation with diagram

  • @damubsr
    @damubsr 2 года назад +1

    Good job,the way of approach is good i.e theory and then code.keep it up

  • @akashtawade9264
    @akashtawade9264 2 года назад +1

    Please upload video on multi-threading tricky questions which asked in interview.

  • @routhuaravind6006
    @routhuaravind6006 Год назад +1

    just subscribed !!!😊for sharing the source code and material
    tnx a lot

  • @aadiraj6126
    @aadiraj6126 3 года назад +1

    Basant sir, I think even there is no guarantee of showing modification as output by ConcurrentHashMap, it depends upon which segment are modified as Iterator is forward moving cursor & cant go back.
    Now suppose, during iteration if we update or added some segment values where iterator had already visited earlier, now ConcurrentHashMap wont able to display those values. In our example, Entry may be added at later segment than Entry and Entry thus its showing in output as Iterator able to access it. 🙏

  • @dipalitusharvlogs7252
    @dipalitusharvlogs7252 Год назад +1

    The Video is very nicely explained.

  • @manojpatil2457
    @manojpatil2457 2 года назад +1

    You are indeed Java Techie sir, Crisp explaination.. 🙌

  • @dhruvkaushik7062
    @dhruvkaushik7062 3 года назад +1

    great work brother.....make video on multithreading as well....and other spring and spring boot

  • @srikanthkusa9615
    @srikanthkusa9615 2 года назад +1

    Awesome explanation and you design a course structure is excellent

  • @ravindranathareddygr8703
    @ravindranathareddygr8703 3 года назад +1

    Thanks for the vedio. Request you to do one AWS EKS microservices deployment .(with 2 services which you created in early vedios)

  • @karamjitsinghsehdev3451
    @karamjitsinghsehdev3451 3 года назад +2

    Excellent coverage of topics. Please make on spring core (same bean name,type) etc.

  • @biswajeetsahoochintu2329
    @biswajeetsahoochintu2329 3 года назад +1

    wow sir sir please go through all interview question of java sir we are waiting for your video sir

  • @amanabhishek8998
    @amanabhishek8998 11 месяцев назад +1

    U rocks again.
    Please make one video of Multithreading interview qustions for more than 5years experienced , in youtube hardly to find any tututorials

    • @Javatechie
      @Javatechie  11 месяцев назад

      Thanks buddy these questions also asked in 8+ experience person

    • @amanabhishek8998
      @amanabhishek8998 11 месяцев назад +1

      ​@Javatechie for collection I have following this one or I can say , to start any new topic I would search your videos first that much believe we people have becoz addition to core concept u are also including project examples which helps us to form scenarios in interview😊

    • @Javatechie
      @Javatechie  11 месяцев назад

      Thank you so much Aman for following Javatechie and appreciate your word 🤗

  • @dhanyav5675
    @dhanyav5675 2 года назад +1

    Hi Javatechie, Thank you so much. Your videos have really helped in my interview prep, I have 2 job offers now
    Your videos are informative and really useful

    • @Javatechie
      @Javatechie  2 года назад

      Cool buddy. Good to hear this

  • @rakshamohan
    @rakshamohan 2 года назад +2

    Great tutorial for quickly brushing up on concepts before interviews. Thank you!

  • @antest6285
    @antest6285 3 года назад +2

    Very nice explanation and thanks for the information about the interview questions. Is it possible to make video on all datastructures

  • @tejastipre9787
    @tejastipre9787 Месяц назад +1

    Jordar video ❤

  • @babuforuful
    @babuforuful 3 года назад +1

    Dear JavaTechie Very good awesome videos

  • @rameshanantavarapu3866
    @rameshanantavarapu3866 2 года назад +1

    Great tutorial for quick recap of concepts
    Great work , Thanks a lot

  • @sushant5800
    @sushant5800 3 года назад +1

    Just woow!!! Great content..keep it up man

  • @ShreyasDangetechie
    @ShreyasDangetechie 3 года назад +1

    very good set of questions covered .. Thanks for the video ..!!

  • @sivamuluguri8142
    @sivamuluguri8142 2 года назад +1

    Amazing explanation thank you.

  • @stephenk297
    @stephenk297 2 года назад +1

    Basant sir,your content very informative Thank you. please make video on spring spring boot and microservice interview questions and answers.

  • @tanujkumaragrawal4756
    @tanujkumaragrawal4756 3 года назад +1

    your content is always best sir

  • @pratishrutipanda6461
    @pratishrutipanda6461 3 года назад +3

    You explained excellently

    • @OracleLand_Official
      @OracleLand_Official 3 года назад

      Watch full collections interview questions here part 10 to 15.....

  • @prakashp1970
    @prakashp1970 Год назад +1

    In case of hashmap there is no lock of thread, that means any thread can access it.

    • @Javatechie
      @Javatechie  Год назад +1

      Yes but the locking mechanism won't allow multiple threads to play with a single map obj

  • @KunalKrishna
    @KunalKrishna 11 месяцев назад +1

    42:47 note there can only be 1 entry with key=null, however, there may be several entries having value = null

  • @pramodkumbhar1175
    @pramodkumbhar1175 3 года назад +2

    Please make one video on multithreading interview questions in java (Future vs CompletableFuture)

  • @shareequasiddiqui4948
    @shareequasiddiqui4948 2 года назад +1

    Please make video on spring and microservice interview questions

  • @piyushraghuwanshi7268
    @piyushraghuwanshi7268 3 года назад +1

    sir naya sikhane ko mila ..

  • @avisheksahoo3679
    @avisheksahoo3679 3 года назад +1

    Good one... as usually very well crafted explanations.

  • @abhinavpandey3356
    @abhinavpandey3356 Месяц назад

    Hi basant ,at 40:20 u mentioned that due to thread acquire lock on whole map so we get concurrent modification but i have a doubt that since hashmap is not thread safe how can it acquire lock..please let me know

  • @shemantsingh765
    @shemantsingh765 2 года назад +1

    very well explained Techie✌✌✌

  • @shubhamshende9995
    @shubhamshende9995 2 года назад +1

    amazing lecture sir....

  • @prisinha
    @prisinha 2 года назад

    44:44 Collections.synchronizedMap(map) and synchronized HashTable both does not have segment level locking mechanism.

  • @AmritAgarwal07
    @AmritAgarwal07 Год назад +1

    If we put any value in map it will generate the hashcode and on that hashcode that particular value will be set right. What if the value or key is null at which index it will be save?

  • @Maddy4645
    @Maddy4645 3 года назад +1

    super content and nice explanation, could you please explain how Get method works internally in Hashmap

  • @uvanana.
    @uvanana. 6 месяцев назад +2

    Superb ❤

  • @rabindrapatra7151
    @rabindrapatra7151 3 года назад +1

    33:41 CopyOnWriteArrayList never checks modcount. So On difference of modCount, it never creates the cloned copy. I think when we created the iterator at that time it created a cloned copy for iteration.

    • @Javatechie
      @Javatechie  3 года назад

      No it check modcount I opened source code and verified it .

    • @rabindrapatra7151
      @rabindrapatra7151 3 года назад

      @@Javatechie public E next() { // this is for CopyOnWriteArrayList
      if (! hasNext())
      throw new NoSuchElementException();
      return (E) snapshot[cursor++];
      }

    • @rabindrapatra7151
      @rabindrapatra7151 3 года назад

      This is for ArrayList:
      public E next() {
      checkForComodification();
      int i = cursor;
      if (i >= size)
      throw new NoSuchElementException();
      Object[] elementData = ArrayList.this.elementData;
      if (i >= elementData.length)
      throw new ConcurrentModificationException();
      cursor = i + 1;
      return (E) elementData[lastRet = i];
      }

  • @srinivasdokare4274
    @srinivasdokare4274 7 дней назад

    15:20
    is it this way that if we use Set Object with Wrapper Class of primitive data type then it doesn't store duplicate.
    But just in case of custom object it stores duplicate objects.
    (just verifying that for Wrapper Class it doesn't store duplicates right?)

  • @sreenivasareddydwarampudi6034
    @sreenivasareddydwarampudi6034 3 года назад +1

    Thank you very much sir🙏🙏🙏

  • @uma4525
    @uma4525 3 года назад +1

    Good content. please upload Multithreading interview questions as well.Thank You!

  • @mikebean.
    @mikebean. 3 года назад +1

    This guy deserves a like

  • @yusufsaifi3108
    @yusufsaifi3108 3 года назад +1

    Nice content keep it up ....

  • @deepakgowda7292
    @deepakgowda7292 Год назад +1

    awesome explanation sir thank you so much sir ❣ sir which company you are working in ?

  • @amolgangadharpaydalwar4279
    @amolgangadharpaydalwar4279 3 года назад +1

    hi sir this is very good video and helpful also but give more questions about collections and also create new video on spring and springboot interviews questions also its also very helpful

  • @enggadda
    @enggadda 2 года назад +1

    hi Sir , can we get the interview questions and answers for Multithreading , i will be verymuch helpful

  • @AshishYadav-se4db
    @AshishYadav-se4db 3 года назад +1

    Basant sir great content 🔥🔥🙏

  • @nabinkhatiwada4597
    @nabinkhatiwada4597 2 года назад +1

    Gurug. Thanks a lot

  • @manindersingh6371
    @manindersingh6371 2 года назад +1

    Nice explaination

  • @prakashp1970
    @prakashp1970 Год назад +1

    Superb bro, thanks

  • @PradipYogi59
    @PradipYogi59 3 года назад

    Please create internal implementation of collection , like how it internal works..

  • @sayanchowdury3245
    @sayanchowdury3245 3 года назад +2

    Sir requesting you to make a video on the programs asked based on arrays,string,lists,sarching and sorting mechanisms

  • @parimalamparimalam10
    @parimalamparimalam10 11 месяцев назад +1

    automation testing also will
    ask same
    way

  • @rabindrapatra7151
    @rabindrapatra7151 3 года назад

    hashmap vs treemap who can find the entry quickly, considering all entries are with unique key

  • @prisinha
    @prisinha 2 года назад +1

    15:15 usage of equals and hash code method

  • @kumarrajakotakonda1351
    @kumarrajakotakonda1351 2 года назад +2

    Wrapper classs of set also doesn’t allow duplicates right?

    • @Javatechie
      @Javatechie  2 года назад

      Wrapper class of set ?

    • @kumarrajakotakonda1351
      @kumarrajakotakonda1351 2 года назад +1

      @@Javatechie u told that while using with custom and wrapper classes need to handle explicitly for duplicate check

    • @Javatechie
      @Javatechie  2 года назад +1

      @@kumarrajakotakonda1351 if you add Custom class without override equals and hashcode method then set will allow duplicate .

    • @kumarrajakotakonda1351
      @kumarrajakotakonda1351 2 года назад +1

      @@Javatechie custom class will allow duplicate but wrapper classes doesn’t allow but u said wrapper classes also will allow duplicate in vedio

    • @Javatechie
      @Javatechie  2 года назад +1

      My mistake

  • @bharatiyaashish
    @bharatiyaashish 3 года назад +2

    TreeMap and TreeSet both follow "Balanced Tree/Red-Black Tree concept", as hashMap is following from java 8 onwards. Thanks anyway 🙏🙏

  • @nafazbenzema9714
    @nafazbenzema9714 3 года назад +1

    40.50 can you explain it again? you said that "ConCurrentHashMap allows multiple threads to access map object simultaneously". If multiple threads access the same object simultaneously, then it is not thread safe any more

    • @Javatechie
      @Javatechie  3 года назад +1

      My bad , based on his locking mechanism multiple thread can access without concurrent exception

  • @ashokkumarrout688
    @ashokkumarrout688 3 года назад +1

    Nice Video as always good contents.

    • @OracleLand_Official
      @OracleLand_Official 3 года назад

      Watch full collections interview questions here part 10 to 15.....

  • @aloksrivastav3176
    @aloksrivastav3176 2 года назад +1

    Amazing content ❤️

  • @vishnunarayanan902
    @vishnunarayanan902 2 года назад +1

    Hi Sir,
    It was a really useful video. In the end, you mentioned that you will cover few more collection interview questions on next video.
    Can you please share the link of that video?

    • @Javatechie
      @Javatechie  2 года назад +1

      I will do that

    • @kshitijbansal3672
      @kshitijbansal3672 Год назад

      @@Javatechie sir pls share the link of the next video...thanks

    • @Javatechie
      @Javatechie  Год назад

      @@kshitijbansal3672 i have not upload yet buddy

  • @obireddybandi613
    @obireddybandi613 3 года назад

    I am eagerly waiting for spring boot and Restful questions

  • @seatconnect224
    @seatconnect224 2 года назад +1

    are you planing to prepare Interview Questions for Spring?

  • @padmathota7627
    @padmathota7627 2 года назад +1

    Excellent

  • @PrudviRajD
    @PrudviRajD 3 года назад +1

    Great as always 👍🏽