17- Synchronized Collections
3:24
2 Mga Speaker
2 Mga Kabanata
74 segment
Mga Speaker
Mga Kabanata
-
0:03
Sometimes we need to share a collection across many threads. So let's create a collection object collection of integers. We call it collection and set it to a new array list. Now let's create two threads and have each thread add three items…
-
1:48
a look. So we have four five six one of our insertions was lost This is because we have a race condition two threads are racing or competing to modify our collection concurrently Now, to solve this problem, we can use a synchronized collect…