If all what you need is the number of distinct key values, a Set would
be sufficient.
Wrapping the access to hashMap into a function doesn't really have any
merits - you can use hashMap.put(a,b); and hashMap.size() directly.
If you do want to use a global in a DRL function, you'll have to pass
it to the function as a parameter.
function setValue(Set set, String a){
set.add(a);
}
-W
On 30/10/2013, bbarani <bbarani(a)gmail.com> wrote:
Sorry for the confusion.
I am just trying to store the value in to a global hashmap (more like a
counter) and get back the total size of the hashmap after all the data is
processed.
function setValue(String a, String b){
hashValue.put(a,b);
}
function int getValue(){
return hashValue.size();
}
--
View this message in context:
http://drools.46999.n3.nabble.com/How-to-use-global-hashmap-in-drools-tp4...
Sent from the Drools: User forum mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users