final Set<Object> keySet = new HashSet<Object>(queryResultSet); //todo: Can't we just use the original set?
for (final Map.Entry<Object, TxnValueWrapper> entry : txMap.entrySet()) {
if (!TxnValueWrapper.Type.REMOVED.equals(entry.getValue().type)) {
final Object value = entry.getValue().value instanceof Data ?
service.toObject(entry.getValue().value) : entry.getValue().value;
final QueryEntry queryEntry = new QueryEntry(null, service.toData(entry.getKey()), entry.getKey(), value);
// apply predicate on txMap.
if (predicate.apply(queryEntry)) {
keySet.add(entry.getKey());
}