Java中是否有BlockingMap作为BlockingQueue? [英] Is there BlockingMap as BlockingQueue in java?

查看:119
本文介绍了Java中是否有BlockingMap作为BlockingQueue?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想拥有一个与BlockingQueue非常相似的BlockingMap数据结构。 BlockingQueue的take方法将在那里等待,直到元素可用。我希望BlockingMap的get方法在那里等待,直到相应的键可用为止?我可以使用这种数据结构吗?

I'd like to have one BlockingMap data structure which is very similar to BlockingQueue. The take method of BlockingQueue will wait there until element is available. I'd like the get method of BlockingMap to wait there until the corresponding key is available? Is this kind of data structure available that I can use ?

推荐答案

我只是使用了 BlockingQueue< Map.Entry< K,V>> 过去。但是最近,我遇到了 Java的阻塞地图。不过,我自己还没有使用过。

I have simply used BlockingQueue<Map.Entry<K,V>> in the past. But recently, I came across this Blocking Map for Java. Haven't used it myself, though.

这篇关于Java中是否有BlockingMap作为BlockingQueue?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆