當前位置: 首頁>>代碼示例>>Java>>正文


Java Collections.asLifoQueue方法代碼示例

本文整理匯總了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);
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:32,代碼來源:UIXDocumentTemplate.java

示例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);
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:31,代碼來源:HtmlBodyTemplate.java

示例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() });
  }
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:16,代碼來源:ComponentContextManagerImpl.java

示例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));
}
 
開發者ID:zhangjunfang,項目名稱:util,代碼行數:11,代碼來源:QueueUtil.java

示例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());
}
 
開發者ID:zhangjunfang,項目名稱:util,代碼行數:12,代碼來源:QueueUtil.java


注:本文中的java.util.Collections.asLifoQueue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。