What does it mean when we say Hashtable or Vector is synchronized?

后端 未结 4 865
借酒劲吻你
借酒劲吻你 2020-12-30 14:27

The questions says it all, just wondering, in an interview, what would you say when they ask you, \"What does it practically mean by Hashtable or Vectors being synchronized?

4条回答
  •  隐瞒了意图╮
    2020-12-30 14:33

    It means that the access to the underlying array/collection (add, get, set, put, remove, etc..etc..) is all synchronized. It cannot take place simultaneously. Virtually, all access is been laid out in a first-in-first-out (FIFO) queue. Only and if only if there's nobody (read: no other thread) who's currently accessing the object, then the next (thread) in queue may access it.

提交回复
热议问题