是否有Java#当前的Java ConcurrentHashMap

我需要c#中的字典/ hashmap,允许您执行以下操作

  1. 放置值并在没有锁定的情况下同时迭代
  2. 锁只放。 get没有被锁定,你可能会同时多次获得

谢谢

在这里查看ConcurrentDictionary: http : //msdn.microsoft.com/en-us/library/dd287191.aspx 。 这应该做你想要的。 请记住,它只是.Net 4。

看看System.Collections.Concurrent – 命名空间! http://msdn.microsoft.com/en-us/library/system.collections.concurrent.aspx

这对我来说听起来像ConcurrentDictionary ,如果您安装了Reactive Extensions ,则可以在.NET 4.0 .NET 3.5中使用。

您也可以使用ReaderWriterLockSlim Class编写自己的ReaderWriterLockSlim Class

否则,只需查看System.Collections.Concurrent Namespace