本文整理匯總了Java中java.util.Collections.asLifoQueue方法的典型用法代碼示例。如果您正苦於以下問題:Java Collections.asLifoQueue方法的具體用法?Java Collections.asLifoQueue怎麽用?Java Collections.asLifoQueue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.util.Collections
的用法示例。
在下文中一共展示了Collections.asLifoQueue方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setupVisitingContext
import java.util.Collections; //導入方法依賴的package包/類
/**
* Suspends any context changes before allowing invokeOnComponent or visitTree calls to continue,
* allowing components to undo any context changes during a re-entrant call.
* @param facesContext the faces context
* @see ComponentContextManager#suspend(FacesContext)
*/
@Override
protected void setupVisitingContext(FacesContext facesContext)
{
ComponentContextManager ctxMgr = RequestContext.getCurrentInstance()
.getComponentContextManager();
// Suspend any current component context during a visit tree for re-entrant
// component tree processing
SuspendedContextChanges suspendedChanges = ctxMgr.suspend(facesContext);
Map<String, Object> reqMap = facesContext.getExternalContext().getRequestMap();
@SuppressWarnings("unchecked")
Queue<SuspendedContextChanges> suspendedChangesQueue = (Queue<SuspendedContextChanges>)
reqMap.get(_SUSPENDED_CHANGES_KEY);
if (suspendedChangesQueue == null)
{
suspendedChangesQueue = Collections.asLifoQueue(new ArrayDeque<SuspendedContextChanges>());
reqMap.put(_SUSPENDED_CHANGES_KEY, suspendedChangesQueue);
}
suspendedChangesQueue.offer(suspendedChanges);
_LOG.fine("UIXDocument suspended context changes in setupVisitingContext");
super.setupVisitingContext(facesContext);
}
示例2: setupVisitingContext
import java.util.Collections; //導入方法依賴的package包/類
/**
* Suspends any context changes before allowing invokeOnComponent or visitTree calls to continue,
* allowing components to undo any context changes during a re-entrant call.
* @param facesContext the faces context
* @see ComponentContextManager#suspend(FacesContext)
*/
@Override
protected void setupVisitingContext(FacesContext facesContext)
{
ComponentContextManager ctxMgr = RequestContext.getCurrentInstance()
.getComponentContextManager();
// Suspend any current component context during a visit tree for re-entrant
// component tree processing
SuspendedContextChanges suspendedChanges = ctxMgr.suspend(facesContext);
Map<String, Object> reqMap = facesContext.getExternalContext().getRequestMap();
@SuppressWarnings("unchecked")
Queue<SuspendedContextChanges> suspendedChangesQueue = (Queue<SuspendedContextChanges>)
reqMap.get(_SUSPENDED_CHANGES_KEY);
if (suspendedChangesQueue == null)
{
suspendedChangesQueue = Collections.asLifoQueue(new ArrayDeque<SuspendedContextChanges>());
reqMap.put(_SUSPENDED_CHANGES_KEY, suspendedChangesQueue);
}
suspendedChangesQueue.offer(suspendedChanges);
super.setupVisitingContext(facesContext);
}
示例3: pushChange
import java.util.Collections; //導入方法依賴的package包/類
public void pushChange(ComponentContextChange change)
{
if (_stack == null)
{
_stack = Collections.asLifoQueue(new ArrayDeque<ComponentContextChange>());
}
_stack.offer(change);
if (_LOG.isFine())
{
_LOG.fine("Component context change pushed onto the stack. Change: {0}. New stack size: {1}",
new Object[] { change, _stack.size() });
}
}
示例4: createStack
import java.util.Collections; //導入方法依賴的package包/類
/**
* 支持後進先出的棧,用ArrayDeque實現, 經過Collections#asLifoQueue()轉換順序
*
* 需設置初始長度,默認為16,數組滿時成倍擴容
*
* @see Collections#asLifoQueue()
*/
public static <E> Queue<E> createStack(int initSize) {
return Collections.asLifoQueue(new ArrayDeque<E>(initSize));
}
示例5: createConcurrentStack
import java.util.Collections; //導入方法依賴的package包/類
/**
* 支持後進先出的並發棧,用ConcurrentLinkedDeque實現,經過Collections#asLifoQueue()轉換順序
*
* 另對於BlockingQueue接口, JDK暫無Lifo倒轉實現,因此隻能直接使用未調轉順序的LinkedBlockingDeque
*
* @see Collections#asLifoQueue()
*/
@SuppressWarnings("unchecked")
public static <E> Queue<E> createConcurrentStack() {
return (Queue<E>) Collections.asLifoQueue(newConcurrentNonBlockingDeque());
}