本文整理汇总了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();
}
}