public class MoreQueues extends Object
| Constructor and Description |
|---|
MoreQueues() |
| Modifier and Type | Method and Description |
|---|---|
static <E> Queue<E> |
createConcurrentStack()
支持后进先出的无阻塞的并发栈,用ConcurrentLinkedDeque实现,经过Collections#asLifoQueue()转换顺序
另对于BlockingQueue接口, JDK暂无Lifo倒转实现,因此只能直接使用未调转顺序的LinkedBlockingDeque
|
static <E> com.google.common.collect.EvictingQueue<E> |
createLRUQueue(int maxSize)
LRUQueue, 如果Queue已满,则删除最旧的元素.
|
static <E> Queue<E> |
createStack(int initSize)
支持后进先出的栈,用ArrayDeque实现, 经过Collections#asLifoQueue()转换顺序
需设置初始长度,默认为16,数组满时成倍扩容
|
public static <E> Queue<E> createStack(int initSize)
Collections#asLifoQueue()public static <E> Queue<E> createConcurrentStack()
Collections#asLifoQueue()public static <E> com.google.common.collect.EvictingQueue<E> createLRUQueue(int maxSize)
Copyright © 2018. All rights reserved.