本文整理了Java中java.util.Collections.asLifoQueue()
方法的一些代码示例,展示了Collections.asLifoQueue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Collections.asLifoQueue()
方法的具体详情如下:
包路径:java.util.Collections
类名称:Collections
方法名:asLifoQueue
[英]Returns a last-in, first-out queue as a view of deque.
[中]返回后进先出队列作为deque的视图。
代码示例来源:origin: springside/springside4
/**
* 支持后进先出的栈,用ArrayDeque实现, 经过Collections#asLifoQueue()转换顺序
*
* 需设置初始长度,默认为16,数组满时成倍扩容
*
* @see Collections#asLifoQueue()
*/
public static <E> Queue<E> createStack(int initSize) {
return Collections.asLifoQueue(new ArrayDeque<E>(initSize));
}
代码示例来源:origin: vipshop/vjtools
/**
* 支持后进先出的栈,用ArrayDeque实现, 经过Collections#asLifoQueue()转换顺序
*
* 需设置初始长度,默认为16,数组满时成倍扩容
*
* @see Collections#asLifoQueue()
*/
public static <E> Queue<E> createStack(int initSize) {
return Collections.asLifoQueue(new ArrayDeque<E>(initSize));
}
代码示例来源:origin: pmd/pmd
@Override
protected Queue<TimerEntry> initialValue() {
return Collections.asLifoQueue(new LinkedList<TimerEntry>());
}
};
代码示例来源:origin: springside/springside4
/**
* 支持后进先出的无阻塞的并发栈,用ConcurrentLinkedDeque实现,经过Collections#asLifoQueue()转换顺序
*
* 另对于BlockingQueue接口, JDK暂无Lifo倒转实现,因此只能直接使用未调转顺序的LinkedBlockingDeque
*
* @see Collections#asLifoQueue()
*/
public static <E> Queue<E> createConcurrentStack() {
return (Queue<E>) Collections.asLifoQueue(QueueUtil.newConcurrentNonBlockingDeque());
}
代码示例来源:origin: vipshop/vjtools
/**
* 支持后进先出的无阻塞的并发栈,用ConcurrentLinkedDeque实现,经过Collections#asLifoQueue()转换顺序
*
* 另对于BlockingQueue接口, JDK暂无Lifo倒转实现,因此只能直接使用未调转顺序的LinkedBlockingDeque
*
* @see Collections#asLifoQueue()
*/
public static <E> Queue<E> createConcurrentStack() {
return (Queue<E>) Collections.asLifoQueue(QueueUtil.newConcurrentNonBlockingDeque());
}
代码示例来源:origin: xuminwlt/j360-dubbo-app-all
/**
* 支持后进先出的栈,用ArrayDeque实现, 经过Collections#asLifoQueue()转换顺序
*
* 需设置初始长度,默认为16,数组满时成倍扩容
*
* @see Collections#asLifoQueue()
*/
public static <E> Queue<E> createStack(int initSize) {
return Collections.asLifoQueue(new ArrayDeque<E>(initSize));
}
代码示例来源:origin: io.springside/springside-utils
/**
* 支持后进先出的栈,用ArrayDeque实现, 经过Collections#asLifoQueue()转换顺序
*
* 需设置初始长度,默认为16,数组满时成倍扩容
*
* @see Collections#asLifoQueue()
*/
public static <E> Queue<E> createStack(int initSize) {
return Collections.asLifoQueue(new ArrayDeque<E>(initSize));
}
代码示例来源:origin: de.learnlib/learnlib-datastructure-pta
@Override
public <S extends AbstractBlueFringePTAState<?, ?, S>> Queue<PTATransition<S>> createWorklist() {
return Collections.asLifoQueue(new ArrayDeque<>());
}
}
代码示例来源:origin: DarLiner/vjtools
/**
* 支持后进先出的栈,用ArrayDeque实现, 经过Collections#asLifoQueue()转换顺序
*
* 需设置初始长度,默认为16,数组满时成倍扩容
*
* @see Collections#asLifoQueue()
*/
public static <E> Queue<E> createStack(int initSize) {
return Collections.asLifoQueue(new ArrayDeque<E>(initSize));
}
代码示例来源:origin: net.sourceforge.pmd/pmd-core
@Override
protected Queue<TimerEntry> initialValue() {
return Collections.asLifoQueue(new LinkedList<TimerEntry>());
}
};
代码示例来源:origin: mwilliamson/java-mammoth
public static <T> Queue<T> stack() {
return Collections.asLifoQueue(new ArrayDeque<>());
}
}
代码示例来源:origin: stackoverflow.com
Queue<Integer> arrayLifoQueue = Collections.asLifoQueue(new ArrayDeque<Integer>());
Queue<Integer> linkedListLifoQueue = Collections.asLifoQueue(new LinkedList<Integer>());
代码示例来源:origin: stackoverflow.com
Queue<Object> stack = Collections.asLifoQueue(new ArrayDeque<Object>());
stack.add("red");
stack.add(Color.GREEN);
stack.add(stack);
代码示例来源:origin: DarLiner/vjtools
/**
* 支持后进先出的无阻塞的并发栈,用ConcurrentLinkedDeque实现,经过Collections#asLifoQueue()转换顺序
*
* 另对于BlockingQueue接口, JDK暂无Lifo倒转实现,因此只能直接使用未调转顺序的LinkedBlockingDeque
*
* @see Collections#asLifoQueue()
*/
public static <E> Queue<E> createConcurrentStack() {
return (Queue<E>) Collections.asLifoQueue(QueueUtil.newConcurrentNonBlockingDeque());
}
代码示例来源:origin: xuminwlt/j360-dubbo-app-all
/**
* 支持后进先出的并发栈,用ConcurrentLinkedDeque实现,经过Collections#asLifoQueue()转换顺序
*
* 另对于BlockingQueue接口, JDK暂无Lifo倒转实现,因此只能直接使用未调转顺序的LinkedBlockingDeque
*
* @see Collections#asLifoQueue()
*/
public static <E> Queue<E> createConcurrentStack() {
return (Queue<E>) Collections.asLifoQueue(newConcurrentNonBlockingDeque());
}
代码示例来源:origin: io.springside/springside-utils
/**
* 支持后进先出的并发栈,用ConcurrentLinkedDeque实现,经过Collections#asLifoQueue()转换顺序
*
* 另对于BlockingQueue接口, JDK暂无Lifo倒转实现,因此只能直接使用未调转顺序的LinkedBlockingDeque
*
* @see Collections#asLifoQueue()
*/
public static <E> Queue<E> createConcurrentStack() {
return (Queue<E>) Collections.asLifoQueue(newConcurrentNonBlockingDeque());
}
代码示例来源:origin: matsim-org/matsim
private Queue<AnswerNode> getInitialNodes(List<PlanRecord> plans ) {
final Queue<AnswerNode> queue = Collections.asLifoQueue( new ArrayDeque<AnswerNode>() );
for ( PlanRecord p : plans ) queue.add( new AnswerNode( p , null ) );
return queue;
}
代码示例来源:origin: apache/james-project
/**
* @param stage the annotation that specifies this stage
* @param mode execution order
*/
public DefaultStager(Class<A> stage, Order mode) {
this.stage = stage;
Queue<Stageable> localStageables;
switch (mode) {
case FIRST_IN_FIRST_OUT: {
localStageables = new ArrayDeque<>();
break;
}
case FIRST_IN_LAST_OUT: {
localStageables = Collections.asLifoQueue(new ArrayDeque<Stageable>());
break;
}
default: {
throw new IllegalArgumentException("Unknown mode: " + mode);
}
}
stageables = localStageables;
}
代码示例来源:origin: fbacchella/LogHub
/**
* Finish the cloning of the copy
* Ensure than transient fields store the good values
* @return
*/
private Object readResolve() {
if (!test) {
timer = Properties.metrics.timer("Allevents.timer").time();
Properties.metrics.counter("Allevents.inflight").inc();
} else {
timer = null;
}
processors = new LinkedList<>();
wevent = null;
timersStack = Collections.asLifoQueue(new ArrayDeque<PausingContext>());
pipelineNames = new ArrayDeque<>();
return this;
}
代码示例来源:origin: stackoverflow.com
public class Practice15 {
public static void main(String[] args) {
Deque<Integer> dd=new ArrayDeque<Integer>();
dd.offerFirst(123);
dd.offerFirst(258);
dd.offerFirst(125);
System.out.println(dd);
Queue<Integer> q1=Collections.asLifoQueue(dd);
System.out.println(q1);
}
内容来源于网络,如有侵权,请联系作者删除!