Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Locking  RSS feed

 
Mike Yu
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Max,
In your book, you synchronized the lock on a Vector object. What are the differences if I synchronize on the methods?
 
Vlad Rabkin
Ranch Hand
Posts: 555
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Max,
One more question: Why did you used Vector instead of ArrayList in your book? There is no need for it since you synchronize access to on reservedDVDs.
Just because a junior programmer is more familiar with Vector ?
Tx,
Vlad
 
Mark Spritzler
ranger
Sheriff
Posts: 17309
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd stick with the ArrayList. It is the preferred Collection to use over Vector.
Mark
 
Mike Yu
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Max,
How about HashMap?
Also can you answer my question at the beginning of this thread?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!