return entrySet;
}
@Override
public Collection<V> values(Predicate predicate) {
PagingPredicate pagingPredicate = null;
if (predicate instanceof PagingPredicate) {
pagingPredicate = (PagingPredicate) predicate;
pagingPredicate.setIterationType(IterationType.VALUE);
if (pagingPredicate.getPage() > 0 && pagingPredicate.getAnchor() == null) {
pagingPredicate.previousPage();
values(pagingPredicate);
pagingPredicate.nextPage();
}
}
MapQueryRequest request = new MapQueryRequest(name, predicate, IterationType.VALUE);
QueryResultSet result = invoke(request);
if (pagingPredicate == null) {
final ArrayList<V> values = new ArrayList<V>(result.size());
for (Object data : result) {
V value = toObject(data);
values.add(value);
}
return values;
}
List<Entry<Object, V>> valueEntryList = new ArrayList<Entry<Object, V>>(result.size());
final Iterator<Entry> iterator = result.rawIterator();
while (iterator.hasNext()) {
final Entry entry = iterator.next();
K key = toObject(entry.getKey());
V value = toObject(entry.getValue());
valueEntryList.add(new AbstractMap.SimpleImmutableEntry<Object, V>(key, value));
}
Collections.sort(valueEntryList, SortingUtil.newComparator(pagingPredicate.getComparator(), IterationType.VALUE));
if (valueEntryList.size() > pagingPredicate.getPageSize()) {
valueEntryList = valueEntryList.subList(0, pagingPredicate.getPageSize());
}
Entry anchor = null;
if (valueEntryList.size() != 0) {
anchor = valueEntryList.get(valueEntryList.size() - 1);
}