Hello Naveen Thank you very much for this video U won’t believe i was in your collections in java playlist just finished then i was thinking is there anyway to make ArrayList synchronized , how to make it possible , or it not possible at all and Now boom 💥 here is the video Perfect awesome thank you for your time and helping everyone to learn in daily basis
@naveenautomationlabs4 жыл бұрын
Thanks for watching :)
@supriyassampath14197 ай бұрын
Thank you so much Naveen for selfless contribution to QA community.. God bless
@nandashivaprasad61593 жыл бұрын
You are awesome loved it .. thank you so much. You are far better than my course which I have taken Loved it !!
@geethapriya51524 жыл бұрын
Hi Naveen,Thanks for your video, its really awesome.When I tried to replicate the same scenario in eclipse I can able to fetch data without Synchronized block using 1st option you mentioned. Ex: List list=Collections.synchronizedList( ArrayList()); list.add("abc");list.add("def");list.add("abc");Iteratori2=inte.iterator();while(i2.hasNext()) {System..println(i2.next());}
@naveenautomationlabs4 жыл бұрын
You can fetch it without any problem without synchronised block but try with multi threads.
@geethapriya51524 жыл бұрын
@@naveenautomationlabs sure, thank you
@rajeshchaudhari82543 жыл бұрын
Hi Naveen, because of you, I'm able to crack two offers. Thank you so much. one request. could you please create one video of synchronized and non-synchronized with real-time scenario? it would really helpful.
@prashantchougale10603 жыл бұрын
Hi Naveen. Thank you much for your videos. I have been following your content and its really amazing and easy to understand.
@Adhurapan3 жыл бұрын
Thanks for this Collections videos series...😊
@muralikrishnap43373 жыл бұрын
Hello Naveen sir really thank you for the valuable topics heartful thanks for the best videos would have touched your feet will meet you one day for sure sir thank you
@supriyamishra59684 жыл бұрын
Out of box concept! Thanks Naveen!
@naveenautomationlabs4 жыл бұрын
Glad you liked it!
@simm56222 жыл бұрын
Thank you, nicely explained. 🏆🏆🏆
@manichowdry5475 ай бұрын
superb Explaintaion
@vasantvarma64064 жыл бұрын
Great video 👌. Can you also give some real time scenarios where synchronisation used in automation
@SuperRahul264 жыл бұрын
Great Job mate, wish you to do many more and detailed ones. please data science in testing wanted to see it in your videos
@naveenautomationlabs4 жыл бұрын
More to come!
@django40843 жыл бұрын
Maybe this will help someone. Why is it named CopyOnWriteArrayList, why dint they use something like SynchoronizedArrayList? Whenever a modification operation is performed on the Array list, the existing array is copied internally, the modification operation is performed on the new copy and then the new array is returned. The old array will be discarded. Hence the name, Copy on write. Modification operations include add, addAll, remove, removeAll, addIf, removeIf, subList etc.
@bnageshw2 жыл бұрын
Hello Naveen, Thank you for the video. Commenting line on 21 also able to run the script successfully and getting same output. What is the difference having the line 21 statement
@vasantvarma64064 жыл бұрын
Great video 👌
@Bhushansk20233 жыл бұрын
Thank You, U r Awesome
@GaneshKumar-qn7od2 жыл бұрын
Naveen, CopyOnWriteArrayList in this class ; do we can use all the methods such as contains, clone,indexOf .... which we discussed
@juandebenedetti28843 жыл бұрын
Thanks for the video! So to use a synchronized collection the best option is to use the CopyOnWriteArrayList class or Collections.synchronizedList()? Another thing, does this replace the use of the Vector class? Thanks!!
@akashranjan878 Жыл бұрын
Just for printing the values there is no requirement of synchronised list but we are using this while adding or removing the values are not allowed while iterating. So below code is not working at all, this is not a proper way of making list synchronised. public static void main(String[] args) { List namesList = Collections.synchronizedList(new ArrayList()); namesList.add("Java"); namesList.add("Python"); namesList.add("Ruby"); synchronized (namesList){ Iterator itr = namesList.iterator(); while (itr.hasNext()){ System.out.println(itr.next()); namesList.add("C++"); } } } Throwing below error. Exception in thread "main" java.util.ConcurrentModificationException at java.base/java.util.ArrayList$Itr.checkForComodification(ArrayList.java:1013) at java.base/java.util.ArrayList$Itr.next(ArrayList.java:967) at com.example.demo.TestClass.main(TestClass.java:19)
@sujay40753 жыл бұрын
Hi Naveen. Thank you much for your videos. I have been following your content and its really amazing and easy to understand. One issue I am facing in my Eclipse editor is, its giving error CopyOnWriteArrayList cannot be resolved to a type, although I have imported the java.util.concurrent package. Please advise on how I can resolve this error.
@programmingghost28632 жыл бұрын
Can you make video on how make hourglass in 2d array
@staslocovai3 жыл бұрын
Hi from Tel Aviv Naveen . Your teaching is amazing . For some reason when i used Iterator it created infinite loop returning "true" . So i used For Each loop and it worked . Anyone can tell why ? Thanks .
@sharadgupta37274 жыл бұрын
Sir could u plz create videos for java interview questions end to end topics thanks
@onkarkulkarni94233 жыл бұрын
Thanks Naveen, one doubt thou - why we dont need explicit synchronization on add and remove as logically update operations can also hamper the synchronization right, say t1 updates the value before t2, OR t1 has already removed the value which t2 is using, so before t2 updates the value, t1 might have already deleted it. so is it implicitly handled by Java...?
@shilpapatnaik85183 жыл бұрын
add/remove operations are done on the synchronized list. Only one thread can access it at a time - so it is thread-safe. Iterators of even synchronized collections are not thread-safe. We need to explicitly synchronize it as shown in the video.
@melsaied1013 жыл бұрын
Thank you
@DiamondStudioYouTube4 жыл бұрын
Thank you!
@riyarb559Ай бұрын
how do we actually check whether what we've created is thread safe. like apart from the two syntaxes for creating thread safe arrayList and using syncronized keyword in first way; there isnt any change i see. Like we can do the same iterator way without synchronized keyword in first way as well and the same output is given. Not really sure what internally is different ? Can anyone who understood please help?
@akashranjan878 Жыл бұрын
You video is incomplete. If it is Synchronize then changing the size of the list(adding or removing lements) is not allowed while iterating that you didnt show which will fail.
@antaksharisalgaonkar62583 жыл бұрын
Please make videos on java 8
@naveenautomationlabs3 жыл бұрын
Hi, please refer this series: kzbin.info/aero/PLFGoYjJG_fqqHMYWY-rW554LdNKl_jAIj
@SuganthanMadhav2 жыл бұрын
What is the purpose of this video? If you are explaining some thread-safe collections make sure to test with multiple threads.
@prashantchougale10603 жыл бұрын
Hi Naveen, Thank you much for your videos. I have been following your content and its really amazing and easy to understand.