public void getSubRecordsBetween(MultiResultSet results, Long from, Long to) {
   Set<Long> values = sortedSet.subSet(from, to);
   for (Long value : values) {
     ConcurrentMap<Long, Record> records = mapRecords.get(value);
     if (records != null) {
       results.addResultSet(value, records.values());
     }
   }
   // to wasn't included so include now
   ConcurrentMap<Long, Record> records = mapRecords.get(to);
   if (records != null) {
     results.addResultSet(to, records.values());
   }
 }
 public void getRecords(MultiResultSet results, Set<Long> values) {
   for (Long value : values) {
     ConcurrentMap<Long, Record> records = mapRecords.get(value);
     if (records != null) {
       results.addResultSet(value, records.values());
     }
   }
 }
  public void getSubRecords(
      MultiResultSet results, PredicateType predicateType, Long searchedValue) {
    Set<Long> values = null;
    boolean notEqual = false;
    switch (predicateType) {
      case LESSER:
        values = sortedSet.headSet(searchedValue, false);
        break;
      case LESSER_EQUAL:
        values = sortedSet.headSet(searchedValue, true);
        break;
      case GREATER:
        values = sortedSet.tailSet(searchedValue, false);
        break;
      case GREATER_EQUAL:
        values = sortedSet.tailSet(searchedValue, true);
        break;
      case NOT_EQUAL:
        values = sortedSet;
        notEqual = true;
        break;
    }

    if (values != null) {
      for (Long value : values) {
        if (notEqual && searchedValue.longValue() == value.longValue()) {
          // skip this value if predicateType is NOT_EQUAL
          continue;
        }
        ConcurrentMap<Long, Record> records = mapRecords.get(value);
        if (records != null) {
          results.addResultSet(value, records.values());
        }
      }
    }
  }