本文整理匯總了Java中java.util.ArrayDeque.clear方法的典型用法代碼示例。如果您正苦於以下問題:Java ArrayDeque.clear方法的具體用法?Java ArrayDeque.clear怎麽用?Java ArrayDeque.clear使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.util.ArrayDeque
的用法示例。
在下文中一共展示了ArrayDeque.clear方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: trackNewWorkUnit
import java.util.ArrayDeque; //導入方法依賴的package包/類
/**
* Store dependency tables for later retrieval by the EE.
* @param workunit
*/
void trackNewWorkUnit(final Map<Integer, List<VoltTable>> dependencies) {
for (final Entry<Integer, List<VoltTable>> e : dependencies.entrySet()) {
// could do this optionally - debug only.
if (debug.val) verifyDependencySanity(e.getKey(), e.getValue());
// create a new list of references to the workunit's table
// to avoid any changes to the WorkUnit's list. But do not
// copy the table data.
ArrayDeque<VoltTable> deque = m_depsById.get(e.getKey());
if (deque == null) {
deque = new ArrayDeque<VoltTable>();
// intentionally overwrite the previous dependency id.
// would a lookup and a clear() be faster?
m_depsById.put(e.getKey(), deque);
} else {
deque.clear();
}
for (VoltTable vt : e.getValue()) {
if (vt != null) deque.add(vt);
} // FOR
}
if (debug.val) LOG.debug("Current InputDepencies:\n" + StringUtil.formatMaps(m_depsById));
}
示例2: testClear
import java.util.ArrayDeque; //導入方法依賴的package包/類
/**
* clear removes all elements
*/
public void testClear() {
ArrayDeque q = populatedDeque(SIZE);
q.clear();
assertTrue(q.isEmpty());
assertEquals(0, q.size());
assertTrue(q.add(new Integer(1)));
assertFalse(q.isEmpty());
q.clear();
assertTrue(q.isEmpty());
}
示例3: clear
import java.util.ArrayDeque; //導入方法依賴的package包/類
final synchronized void clear(ArrayDeque q) {
q.clear();
}