本文整理匯總了Java中com.google.common.collect.PeekingIterator.remove方法的典型用法代碼示例。如果您正苦於以下問題:Java PeekingIterator.remove方法的具體用法?Java PeekingIterator.remove怎麽用?Java PeekingIterator.remove使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.common.collect.PeekingIterator
的用法示例。
在下文中一共展示了PeekingIterator.remove方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: updateForRow
import com.google.common.collect.PeekingIterator; //導入方法依賴的package包/類
private void updateForRow(PeekingIterator<PartitionUpdate.CounterMark> markIter, Row row, ColumnFamilyStore cfs)
{
int cmp = 0;
// If the mark is before the row, we have no value for this mark, just consume it
while (markIter.hasNext() && (cmp = compare(markIter.peek().clustering(), row.clustering(), cfs)) < 0)
markIter.next();
if (!markIter.hasNext())
return;
while (cmp == 0)
{
PartitionUpdate.CounterMark mark = markIter.next();
Cell cell = mark.path() == null ? row.getCell(mark.column()) : row.getCell(mark.column(), mark.path());
if (cell != null)
{
updateWithCurrentValue(mark, CounterContext.instance().getLocalClockAndCount(cell.value()), cfs);
markIter.remove();
}
if (!markIter.hasNext())
return;
cmp = compare(markIter.peek().clustering(), row.clustering(), cfs);
}
}
示例2: cleanupCache
import com.google.common.collect.PeekingIterator; //導入方法依賴的package包/類
private void cleanupCache(long now) {
PeekingIterator<Triple<Long, K1, K2>> it = Iterators.peekingIterator(timeouts.iterator());
while (it.hasNext() && it.peek().getLeft() < now) {
Triple<Long, K1, K2> t = it.next();
values.remove(new Pair<>(t.getMiddle(), t.getRight()));
secondLevelKeys.computeIfPresent(t.getMiddle(), (k, v) -> {
Set<K2> res = new ConcurrentSkipListSet<>(v);
res.remove(t.getRight());
if (res.isEmpty())
return null;
return res;
});
it.remove();
}
}