Example usage for java.util.concurrent ConcurrentSkipListMap lowerEntry

List of usage examples for java.util.concurrent ConcurrentSkipListMap lowerEntry

Introduction

In this page you can find the example usage for java.util.concurrent ConcurrentSkipListMap lowerEntry.

Prototype

public Map.Entry<K, V> lowerEntry(K key) 

Source Link

Document

Returns a key-value mapping associated with the greatest key strictly less than the given key, or null if there is no such key.

Usage

From source file:com.palantir.atlasdb.keyvalue.impl.InMemoryKeyValueService.java

@Override
public Map<Cell, Value> get(String tableName, Map<Cell, Long> timestampByCell) {
    ConcurrentSkipListMap<Key, byte[]> table = getTableMap(tableName).entries;
    Map<Cell, Value> result = Maps.newHashMap();
    for (Map.Entry<Cell, Long> e : timestampByCell.entrySet()) {
        Cell cell = e.getKey();/* ww  w  .j ava  2  s  .c o m*/
        Entry<Key, byte[]> lastEntry = table.lowerEntry(new Key(cell, e.getValue()));
        if (lastEntry != null) {
            Key key = lastEntry.getKey();
            if (key.matchesCell(cell)) {
                long ts = lastEntry.getKey().ts;
                byte[] value = lastEntry.getValue();
                result.put(cell, Value.create(value, ts));
            }
        }
    }
    return result;
}