本文整理了Java中java.util.concurrent.ConcurrentSkipListMap.subMap()
方法的一些代码示例,展示了ConcurrentSkipListMap.subMap()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ConcurrentSkipListMap.subMap()
方法的具体详情如下:
包路径:java.util.concurrent.ConcurrentSkipListMap
类名称:ConcurrentSkipListMap
方法名:subMap
暂无
代码示例来源:origin: robovm/robovm
/**
* @throws ClassCastException {@inheritDoc}
* @throws NullPointerException if {@code fromKey} or {@code toKey} is null
* @throws IllegalArgumentException {@inheritDoc}
*/
public ConcurrentNavigableMap<K,V> subMap(K fromKey, K toKey) {
return subMap(fromKey, true, toKey, false);
}
代码示例来源:origin: apache/geode
@Override
public CloseableIterator<Entry> iterator(Object start, boolean startInclusive, Object end,
boolean endInclusive) {
return new IterImpl(map.subMap(start, startInclusive, end, endInclusive).entrySet().iterator());
}
代码示例来源:origin: apache/geode
@Override
public CloseableIterator<Entry> iterator(Object start, boolean startInclusive) {
// TODO Auto-generated method stub
return new IterImpl(map.subMap(start, startInclusive).entrySet().iterator());
}
代码示例来源:origin: apache/geode
@Override
public CloseableIterator<CachedDeserializable> keyIterator(Object start, boolean startInclusive,
Object end, boolean endInclusive) {
return new ItrAdapter(map.subMap(start, startInclusive, end, endInclusive).keySet().iterator());
}
代码示例来源:origin: apache/geode
@Override
public CloseableIterator<CachedDeserializable> keyIterator(Object start, boolean startInclusive) {
return new ItrAdapter(map.subMap(start, startInclusive).keySet().iterator());
}
代码示例来源:origin: apache/geode
@Override
public long size(Object start, Object end) {
byte[] startBytes = ByteComparator.MIN_BYTES;
byte[] endBytes = ByteComparator.MAX_BYTES;
return map.subMap(new Pair(start, startBytes), new Pair(end, endBytes)).size();
}
代码示例来源:origin: apache/geode
@Override
public CloseableIterator<IndexEntry> get(Object indexKey) {
return new Itr(map.subMap(new Pair(indexKey, ByteComparator.MIN_BYTES), true,
new Pair(indexKey, ByteComparator.MAX_BYTES), true).entrySet().iterator());
}
代码示例来源:origin: apache/geode
@Override
public CloseableIterator<CachedDeserializable> getKey(Object indexKey) {
return new KeyItr(map.subMap(new Pair(indexKey, ByteComparator.MIN_BYTES), true,
new Pair(indexKey, ByteComparator.MAX_BYTES), true).entrySet().iterator());
}
代码示例来源:origin: apache/geode
@Override
public CloseableIterator<CachedDeserializable> keyIterator(Object start, boolean startInclusive,
Object end, boolean endInclusive) {
byte[] startBytes = startInclusive ? ByteComparator.MIN_BYTES : ByteComparator.MAX_BYTES;
byte[] endBytes = endInclusive ? ByteComparator.MAX_BYTES : ByteComparator.MIN_BYTES;
return new KeyItr(map
.subMap(new Pair(start, startBytes), startInclusive, new Pair(end, endBytes), endInclusive)
.entrySet().iterator());
}
代码示例来源:origin: apache/geode
@Override
public CloseableIterator<IndexEntry> iterator(Object start, boolean startInclusive, Object end,
boolean endInclusive) {
byte[] startBytes = startInclusive ? ByteComparator.MIN_BYTES : ByteComparator.MAX_BYTES;
byte[] endBytes = endInclusive ? ByteComparator.MAX_BYTES : ByteComparator.MIN_BYTES;
return new Itr(map
.subMap(new Pair(start, startBytes), startInclusive, new Pair(end, endBytes), endInclusive)
.entrySet().iterator());
}
代码示例来源:origin: apache/hive
Iterator<Map.Entry<Long, LlapDataBuffer>> matches = cache.subMap(
absOffset, currentNotCached.getEnd() + baseOffset)
.entrySet().iterator();
代码示例来源:origin: io.dropwizard.metrics/metrics-core
private void trim() {
final long now = getTick();
final long windowStart = now - window;
final long windowEnd = now + CLEAR_BUFFER;
if (windowStart < windowEnd) {
measurements.headMap(windowStart).clear();
measurements.tailMap(windowEnd).clear();
} else {
measurements.subMap(windowEnd, windowStart).clear();
}
}
}
代码示例来源:origin: tjake/Solandra
public ConcurrentNavigableMap<Term, LucandraTermInfo[]> skipTo(Term skip) throws IOException
{
Pair<Term, Term> range = null;
int bufferSize = termList.isEmpty() ? 1 : 3;
// verify we've buffered sufficiently
Map.Entry<Term, Pair<Term, Term>> tailEntry = termQueryBoundries.ceilingEntry(skip);
boolean needsBuffering = true;
if (tailEntry != null)
{
range = tailEntry.getValue();
//skip term must be within a buffered range avoid rebuffering
if (skip.compareTo(range.left) >= 0 && (!range.right.equals(emptyTerm) && skip.compareTo(range.right) < 0))
{
needsBuffering = false;
}
}
ConcurrentNavigableMap<Term, LucandraTermInfo[]> subList = emptyMap;
if (needsBuffering)
{
range = bufferTerms(skip, bufferSize);
}
//logger.info(Thread.currentThread().getName()+" rebuffered "+needsBuffering+" "+range);
if (skip.compareTo(range.left) >= 0 && (!range.right.equals(emptyTerm)) && skip.compareTo(range.right) <= 0)
{
subList = termList.subMap(skip, true, range.right, true);
}
return subList;
}
代码示例来源:origin: palantir/atlasdb
@Override
public Multimap<Cell, Long> getAllTimestamps(TableReference tableRef, Set<Cell> cells, long ts) {
Multimap<Cell, Long> multimap = HashMultimap.create();
ConcurrentSkipListMap<Key, byte[]> table = getTableMap(tableRef).entries;
for (Cell key : cells) {
for (Key entry : table.subMap(new Key(key, Long.MIN_VALUE), new Key(key, ts)).keySet()) {
multimap.put(key, entry.ts);
}
}
return multimap;
}
代码示例来源:origin: apache/accumulo
@VisibleForTesting
protected void updateCache(KeyExtent e) {
Text prevRow = e.getPrevEndRow() == null ? new Text() : e.getPrevEndRow();
Text endRow = e.getEndRow() == null ? MAX : e.getEndRow();
extents.subMap(prevRow, e.getPrevEndRow() == null, endRow, true).clear();
extents.put(endRow, e);
}
代码示例来源:origin: palantir/atlasdb
@Override
@SuppressWarnings({"CheckReturnValue"}) // Consume all remaining values of iterator.
public Map<Cell, Value> getRows(TableReference tableRef, Iterable<byte[]> rows,
ColumnSelection columnSelection, long timestamp) {
Map<Cell, Value> result = Maps.newHashMap();
ConcurrentSkipListMap<Key, byte[]> table = getTableMap(tableRef).entries;
for (byte[] row : rows) {
Cell rowBegin = Cells.createSmallestCellForRow(row);
Cell rowEnd = Cells.createLargestCellForRow(row);
PeekingIterator<Entry<Key, byte[]>> entries = Iterators.peekingIterator(table.subMap(
new Key(rowBegin, Long.MIN_VALUE), new Key(rowEnd, timestamp)).entrySet().iterator());
while (entries.hasNext()) {
Entry<Key, byte[]> entry = entries.peek();
Key key = entry.getKey();
Iterator<Entry<Key, byte[]>> cellIter = takeCell(entries, key);
if (columnSelection.contains(key.col)) {
getLatestVersionOfCell(row, key, cellIter, timestamp, result);
}
Iterators.size(cellIter);
}
}
return result;
}
代码示例来源:origin: palantir/atlasdb
private RowColumnRangeIterator getColumnRangeForSingleRow(ConcurrentSkipListMap<Key, byte[]> table,
byte[] row,
ColumnRangeSelection columnRangeSelection,
long timestamp) {
Cell rowBegin;
if (columnRangeSelection.getStartCol().length > 0) {
rowBegin = Cell.create(row, columnRangeSelection.getStartCol());
} else {
rowBegin = Cells.createSmallestCellForRow(row);
}
// Inclusive last cell.
Cell rowEnd;
if (columnRangeSelection.getEndCol().length > 0) {
rowEnd = Cell.create(row, RangeRequests.previousLexicographicName(columnRangeSelection.getEndCol()));
} else {
rowEnd = Cells.createLargestCellForRow(row);
}
PeekingIterator<Entry<Key, byte[]>> entries = Iterators.peekingIterator(table.subMap(
new Key(rowBegin, Long.MIN_VALUE), new Key(rowEnd, timestamp)).entrySet().iterator());
Map<Cell, Value> rowResults = new LinkedHashMap<>();
while (entries.hasNext()) {
Entry<Key, byte[]> entry = entries.peek();
Key key = entry.getKey();
Iterator<Entry<Key, byte[]>> cellIter = takeCell(entries, key);
getLatestVersionOfCell(row, key, cellIter, timestamp, rowResults);
}
return new LocalRowColumnRangeIterator(rowResults.entrySet().iterator());
}
代码示例来源:origin: MobiVM/robovm
/**
* @throws ClassCastException {@inheritDoc}
* @throws NullPointerException if {@code fromKey} or {@code toKey} is null
* @throws IllegalArgumentException {@inheritDoc}
*/
public ConcurrentNavigableMap<K,V> subMap(K fromKey, K toKey) {
return subMap(fromKey, true, toKey, false);
}
代码示例来源:origin: cinchapi/concourse
@Override
public ConcurrentNavigableMap<K, V> subMap(K fromKey, boolean fromInclusive,
K toKey, boolean toInclusive) {
long[] stamps = grabAllSegmentWriteLocks();
try {
sort();
return sorted.subMap(fromKey, fromInclusive, toKey, toInclusive);
}
finally {
releaseSegmentLocks(stamps);
}
}
代码示例来源:origin: apache/samza
@Override
public KeyValueIterator<K, V> range(K from, K to) {
ConcurrentNavigableMap<byte[], byte[]> values = map.subMap(keySerde.toBytes(from), keySerde.toBytes(to));
return new InMemoryIterator(values.entrySet().iterator(), keySerde, valSerde);
}
内容来源于网络,如有侵权,请联系作者删除!