#5 - How to

  Рет қаралды 47,300

Naveen AutomationLabs

Naveen AutomationLabs

Күн бұрын

Пікірлер: 41
@jeyhunaliyev1765
@jeyhunaliyev1765 4 жыл бұрын
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
@naveenautomationlabs
@naveenautomationlabs 4 жыл бұрын
Thanks for watching :)
@supriyassampath1419
@supriyassampath1419 7 ай бұрын
Thank you so much Naveen for selfless contribution to QA community.. God bless
@nandashivaprasad6159
@nandashivaprasad6159 3 жыл бұрын
You are awesome loved it .. thank you so much. You are far better than my course which I have taken Loved it !!
@geethapriya5152
@geethapriya5152 4 жыл бұрын
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());}
@naveenautomationlabs
@naveenautomationlabs 4 жыл бұрын
You can fetch it without any problem without synchronised block but try with multi threads.
@geethapriya5152
@geethapriya5152 4 жыл бұрын
@@naveenautomationlabs sure, thank you
@rajeshchaudhari8254
@rajeshchaudhari8254 3 жыл бұрын
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.
@prashantchougale1060
@prashantchougale1060 3 жыл бұрын
Hi Naveen. Thank you much for your videos. I have been following your content and its really amazing and easy to understand.
@Adhurapan
@Adhurapan 3 жыл бұрын
Thanks for this Collections videos series...😊
@muralikrishnap4337
@muralikrishnap4337 3 жыл бұрын
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
@supriyamishra5968
@supriyamishra5968 4 жыл бұрын
Out of box concept! Thanks Naveen!
@naveenautomationlabs
@naveenautomationlabs 4 жыл бұрын
Glad you liked it!
@simm5622
@simm5622 2 жыл бұрын
Thank you, nicely explained. 🏆🏆🏆
@manichowdry547
@manichowdry547 5 ай бұрын
superb Explaintaion
@vasantvarma6406
@vasantvarma6406 4 жыл бұрын
Great video 👌. Can you also give some real time scenarios where synchronisation used in automation
@SuperRahul26
@SuperRahul26 4 жыл бұрын
Great Job mate, wish you to do many more and detailed ones. please data science in testing wanted to see it in your videos
@naveenautomationlabs
@naveenautomationlabs 4 жыл бұрын
More to come!
@django4084
@django4084 3 жыл бұрын
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.
@bnageshw
@bnageshw 2 жыл бұрын
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
@vasantvarma6406
@vasantvarma6406 4 жыл бұрын
Great video 👌
@Bhushansk2023
@Bhushansk2023 3 жыл бұрын
Thank You, U r Awesome
@GaneshKumar-qn7od
@GaneshKumar-qn7od 2 жыл бұрын
Naveen, CopyOnWriteArrayList in this class ; do we can use all the methods such as contains, clone,indexOf .... which we discussed
@juandebenedetti2884
@juandebenedetti2884 3 жыл бұрын
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
@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)
@sujay4075
@sujay4075 3 жыл бұрын
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.
@programmingghost2863
@programmingghost2863 2 жыл бұрын
Can you make video on how make hourglass in 2d array
@staslocovai
@staslocovai 3 жыл бұрын
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 .
@sharadgupta3727
@sharadgupta3727 4 жыл бұрын
Sir could u plz create videos for java interview questions end to end topics thanks
@onkarkulkarni9423
@onkarkulkarni9423 3 жыл бұрын
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...?
@shilpapatnaik8518
@shilpapatnaik8518 3 жыл бұрын
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.
@melsaied101
@melsaied101 3 жыл бұрын
Thank you
@DiamondStudioYouTube
@DiamondStudioYouTube 4 жыл бұрын
Thank you!
@riyarb559
@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
@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.
@antaksharisalgaonkar6258
@antaksharisalgaonkar6258 3 жыл бұрын
Please make videos on java 8
@naveenautomationlabs
@naveenautomationlabs 3 жыл бұрын
Hi, please refer this series: kzbin.info/aero/PLFGoYjJG_fqqHMYWY-rW554LdNKl_jAIj
@SuganthanMadhav
@SuganthanMadhav 2 жыл бұрын
What is the purpose of this video? If you are explaining some thread-safe collections make sure to test with multiple threads.
@prashantchougale1060
@prashantchougale1060 3 жыл бұрын
Hi Naveen, Thank you much for your videos. I have been following your content and its really amazing and easy to understand.
Quando A Diferença De Altura É Muito Grande 😲😂
00:12
Mari Maria
Рет қаралды 45 МЛН
She made herself an ear of corn from his marmalade candies🌽🌽🌽
00:38
Valja & Maxim Family
Рет қаралды 18 МЛН
#8 - What is HashMap? How to iterate HashMap?
19:57
Naveen AutomationLabs
Рет қаралды 62 М.
Explain Generics in C#? When and why to use them in real applications?
5:57
Multithreading in Java Explained in 10 Minutes
10:01
Coding with John
Рет қаралды 1 МЛН
ConcurrentHashmap in Java and its differences with Synchronized HashMap
11:34
Java ReentrantLock - fairness, tryLock and more
13:17
Defog Tech
Рет қаралды 137 М.
#92 ArrayList in Java
11:54
Telusko
Рет қаралды 142 М.