Example usage for java.util.concurrent ConcurrentNavigableMap subMap

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

Introduction

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

Prototype

ConcurrentNavigableMap<K, V> subMap(K fromKey, boolean fromInclusive, K toKey, boolean toInclusive);

Source Link

Usage

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

private Iterator<Key> buildRangeIteration(Predicate left, Predicate right) {
    if (!sorted) {
        tableScan = true;/*from w w  w .jav  a  2  s.  c  om*/
        return remoteStore.getStore().getMap().keySet().iterator();
    } else {
        boolean inclusive = (left.getOperator() == GreaterEQ || left.getOperator() == Predicate.Operator.LessEQ)
                ? true
                : false;
        ConcurrentNavigableMap sortedStore = (ConcurrentNavigableMap) ((RemoteScanStore) remoteStore)
                .getSortedStore().getMap();
        if (left.getOperator() == Predicate.Operator.GreaterEQ
                || left.getOperator() == Predicate.Operator.Greater) {
            Key from = createKey(left.right().getValue(), keyType);
            Key to = createKey(right.right().getValue(), keyType);
            return sortedStore.subMap(from, inclusive, to, inclusive).keySet().iterator();
        } else {
            Key from = createKey(right.right().getValue(), keyType);
            Key to = createKey(left.right().getValue(), keyType);
            return sortedStore.subMap(from, inclusive, to, inclusive).keySet().iterator();
        }
    }
}