@Override
    @SuppressWarnings("unchecked")
    public Collection values(Predicate predicate) {
        checkTransactionState();
        checkNotNull(predicate, "Predicate can not be null!");
        checkNotInstanceOf(PagingPredicate.class, predicate, "Paging is not supported for Transactional queries");
        MapQueryEngine queryEngine = mapServiceContext.getMapQueryEngine(name);
        SerializationService serializationService = getNodeEngine().getSerializationService();
        QueryResult result = queryEngine.invokeQueryAllPartitions(name, predicate, IterationType.ENTRY);
        QueryResultCollection<Map.Entry> queryResult
                = new QueryResultCollection<Map.Entry>(serializationService, IterationType.ENTRY, false, true, result);
        // TODO: Can't we just use the original set?
        List<Object> valueSet = new ArrayList<Object>();
        Set<Object> keyWontBeIncluded = new HashSet<Object>();
        Extractors extractors = mapServiceContext.getExtractors(name);
        // iterate over the txMap and see if the values are updated or removed
        for (Map.Entry<Data, TxnValueWrapper> entry : txMap.entrySet()) {
            boolean isRemoved = Type.REMOVED.equals(entry.getValue().type);
            boolean isUpdated = Type.UPDATED.equals(entry.getValue().type);
            Object keyObject = serializationService.toObject(entry.getKey());
            if (isRemoved) {
                keyWontBeIncluded.add(keyObject);
            } else {
                if (isUpdated) {
                    keyWontBeIncluded.add(keyObject);
                }
                Object entryValue = entry.getValue().value;
                QueryableEntry queryEntry = new CachedQueryEntry((InternalSerializationService) serializationService,
                        entry.getKey(), entryValue, extractors);
                if (predicate.apply(queryEntry)) {
                    valueSet.add(queryEntry.getValue());
                }
            }
        }
        removeFromResultSet(queryResult, valueSet, keyWontBeIncluded);
        return valueSet;
    }
@Override
    @SuppressWarnings("unchecked")
    public Collection values(Predicate predicate) {
        checkTransactionState();
        checkNotNull(predicate, "Predicate can not be null!");
        checkNotInstanceOf(PagingPredicate.class, predicate, "Paging is not supported for Transactional queries");
        MapQueryEngine queryEngine = mapServiceContext.getMapQueryEngine(name);
        SerializationService serializationService = getNodeEngine().getSerializationService();
        QueryResult result = queryEngine.invokeQueryAllPartitions(name, predicate, IterationType.ENTRY);
        QueryResultCollection<Map.Entry> queryResult
                = new QueryResultCollection<Map.Entry>(serializationService, IterationType.ENTRY, false, true, result);
       
        List<Object> valueSet = new ArrayList<Object>();
        Set<Object> keyWontBeIncluded = new HashSet<Object>();
        Extractors extractors = mapServiceContext.getExtractors(name);
       
        for (Map.Entry<Data, TxnValueWrapper> entry : txMap.entrySet()) {
            boolean isRemoved = Type.REMOVED.equals(entry.getValue().type);
            boolean isUpdated = Type.UPDATED.equals(entry.getValue().type);
            Object keyObject = serializationService.toObject(entry.getKey());
            if (isRemoved) {
                keyWontBeIncluded.add(keyObject);
            } else {
                if (isUpdated) {
                    keyWontBeIncluded.add(keyObject);
                }
                Object entryValue = entry.getValue().value;
                QueryableEntry queryEntry = new CachedQueryEntry((InternalSerializationService) serializationService,
                        entry.getKey(), entryValue, extractors);
                if (predicate.apply(queryEntry)) {
                    valueSet.add(queryEntry.getValue());
                }
            }
        }
        removeFromResultSet(queryResult, valueSet, keyWontBeIncluded);
        return valueSet;
    }
@override @suppresswarnings("unchecked") public collection values(predicate predicate) { checktransactionstate(); checknotnull(predicate, "predicate can not be null!"); checknotinstanceof(pagingpredicate.class, predicate, "paging is not supported for transactional queries"); mapqueryengine queryengine = mapservicecontext.getmapqueryengine(name); serializationservice serializationservice = getnodeengine().getserializationservice(); queryresult result = queryengine.invokequeryallpartitions(name, predicate, iterationtype.entry); queryresultcollection<map.entry> queryresult = new queryresultcollection<map.entry>(serializationservice, iterationtype.entry, false, true, result); list<object> valueset = new arraylist<object>(); set<object> keywontbeincluded = new hashset<object>(); extractors extractors = mapservicecontext.getextractors(name); for (map.entry<data, txnvaluewrapper> entry : txmap.entryset()) { boolean isremoved = type.removed.equals(entry.getvalue().type); boolean isupdated = type.updated.equals(entry.getvalue().type); object keyobject = serializationservice.toobject(entry.getkey()); if (isremoved) { keywontbeincluded.add(keyobject); } else { if (isupdated) { keywontbeincluded.add(keyobject); } object entryvalue = entry.getvalue().value; queryableentry queryentry = new cachedqueryentry((internalserializationservice) serializationservice, entry.getkey(), entryvalue, extractors); if (predicate.apply(queryentry)) { valueset.add(queryentry.getvalue()); } } } removefromresultset(queryresult, valueset, keywontbeincluded); return valueset; }