Example usage for java.util.concurrent ConcurrentNavigableMap headMap

List of usage examples for java.util.concurrent ConcurrentNavigableMap headMap

Introduction

In this page you can find the example usage for java.util.concurrent ConcurrentNavigableMap headMap.

Prototype

ConcurrentNavigableMap<K, V> headMap(K toKey, boolean inclusive);

Source Link

Usage

From source file:com.sm.store.server.QueryIterator.java

private Iterator<Key> buildRest(Predicate predicate) {
    if (!sorted) {
        tableScan = true;//from   ww w  .j a  va  2s.  com
        return remoteStore.getStore().getMap().keySet().iterator();
    } else {
        boolean inclusive = (predicate.getOperator() == GreaterEQ
                || predicate.getOperator() == Predicate.Operator.LessEQ) ? true : false;
        ConcurrentNavigableMap sortedStore = (ConcurrentNavigableMap) ((RemoteScanStore) remoteStore)
                .getSortedStore().getMap();
        if (predicate.getOperator() == Predicate.Operator.GreaterEQ
                || predicate.getOperator() == Predicate.Operator.Greater) {
            Key from = createKey(predicate.right().getValue(), keyType);
            return sortedStore.tailMap(from, inclusive).keySet().iterator();
        } else {
            Key from = createKey(predicate.right().getValue(), keyType);
            return sortedStore.headMap(from, inclusive).keySet().iterator();
        }
    }
}