@Override public Result<K, T> execute(Query<K, T> query) { K startKey = query.getStartKey(); K endKey = query.getEndKey(); if (startKey == null) { if (!cacheEntryList.isEmpty()) { startKey = (K) cacheEntryList.first(); } } if (endKey == null) { if (!cacheEntryList.isEmpty()) { endKey = (K) cacheEntryList.last(); } } query.setFields(getFieldsToQuery(query.getFields())); ConcurrentSkipListSet<K> cacheEntrySubList = null; try { cacheEntrySubList = (ConcurrentSkipListSet<K>) cacheEntryList.subSet(startKey, true, endKey, true); } catch (NullPointerException npe) { LOG.error( "NPE occurred while executing the query for JCacheStore. Hence returning empty entry set.", npe); return new JCacheResult<>(this, query, new ConcurrentSkipListSet<K>()); } return new JCacheResult<>(this, query, cacheEntrySubList); }
@Override public Result<K, T> execute(Query<K, T> query) { K startKey = query.getStartKey(); K endKey = query.getEndKey(); if (startKey == null) { startKey = map.firstKey(); } if (endKey == null) { endKey = map.lastKey(); } // check if query.fields is null query.setFields(getFieldsToQuery(query.getFields())); NavigableMap<K, T> submap = map.subMap(startKey, true, endKey, true); return new MemResult<K, T>(this, query, submap); }