HazelcastInstance instance = Hazelcast.newHazelcastInstance(null);
IMap<String, String> map = instance.getMap("map");
map.put("key1", "value1");
map.put("key2", "value2");
EntryObject e = new PredicateBuilder().getEntryObject();
Predicate p1 = e.key().equal("key1");
Predicate predicate = e.key().equal("key2").or(p1);
Collection values = map.values(predicate);
System.out.println(values.size());
If I have an IMap that's typed as follows - IMap<K, Set<V>>, can I still use a predicate that references the keys? Assuming the key is "id", would I be able to do something like this as a predicate : "id IN (1,2,3,4,5)"? Thus enabling me to look up the values for multiple keys in a single operation.I know I can use a MultiMap to store multiple values at a key, but one get can only lookup the values for a single key at a time.
--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To view this discussion on the web visit https://groups.google.com/d/msg/hazelcast/-/lXe370sdSa4J.
To post to this group, send email to haze...@googlegroups.com.
To unsubscribe from this group, send email to hazelcast+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/hazelcast?hl=en.
You can use predicate builder as follows:HazelcastInstance instance = Hazelcast.newHazelcastInstance(null);
IMap<String, String> map = instance.getMap("map");
map.put("key1", "value1");
map.put("key2", "value2");
EntryObject e = new PredicateBuilder().getEntryObject();
Predicate p1 = e.key().equal("key1");
Predicate predicate = e.key().equal("key2").or(p1);
Collection values = map.values(predicate);
System.out.println(values.size());
On Sat, Jul 7, 2012 at 6:02 AM, Neil Martin wrote:
If I have an IMap that's typed as follows - IMap<K, Set<V>>, can I still use a predicate that references the keys? Assuming the key is "id", would I be able to do something like this as a predicate : "id IN (1,2,3,4,5)"? Thus enabling me to look up the values for multiple keys in a single operation.I know I can use a MultiMap to store multiple values at a key, but one get can only lookup the values for a single key at a time.
--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To view this discussion on the web visit https://groups.google.com/d/msg/hazelcast/-/lXe370sdSa4J.
To post to this group, send email to haze...@googlegroups.com.
To unsubscribe from this group, send email to hazelcast+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/hazelcast/-/d2rrgV8jpn4J.
To unsubscribe from this group, send email to hazelcast+...@googlegroups.com.