java FifoBuffer apache common collections 4替换
我想升级到apache。平民collections4,但是一些类CircularFifoBuffer
和UnboundedFifoBuffer
被删除
import org.apache.commons.collections.buffer.CircularFifoBuffer;
这些类的正确替代品是什么
找到几个suggestions:
hadJan Haderka
Or perhaps there's yet another option:
replace buffer with MinMaxPriorityQueue which on it's own is also not thread safe, but guava fortunately provides wrapper for thread safety in form of Queues.synchronizedQueue(Queue q) call. Since we use guava elsewhere already it should be ok to use the library instead of commons. Not sure about performance comparison of the two tho.
Cedric Reichenbach
it seems like Queues#synchronizedQueue is indeed the equivalent of BufferUtils#synchronizedBuffer, i.e. synchronizes every access to the contained queue/buffer. However, a more precise match in Guava for CircularFifoBuffer would probably be EvictingQueue, or, since the sync wrapper works for any Queue, even Java's own Apache's new CircularFifoQueue.
我在{a2}或{a3}中没有找到答案
# 1 楼答案
在任务COLLECTIONS-432 Replace Buffer interface with java.util.Queue中找到答案