How to clear the HashMap in wM?

Hi All,

Is there a way to clear the HashMap in single shot?

In Java we have clear() method. In wM we have remove() method in PSUtilities2_3 package which we can modify to use for HashMap.

Tried assigning HashMap = null; but it didn’t work out. Still the size of HashMap is > 0.

Any guess.


One thing is not clear to me, i.e. HashMap is a class of Java. If you are implementing in WM using Java program then same clear() method can be used. So what different you are trying?

A common practice is to not use the PSUtilities services directly. Rather, copy them to your own package to insulate them from future PSUtilities updates. The reason to do this is PSUtilities is not an official wM package and is not supported. They do not guarantee that subsequent releases will not change the behavior of services.

Write your own Java service that accepts a hashmap as the input object and call clear.

Or, just drop the hashmap object from the pipeline and then create a new one for whatever you’re doing.

Hi Vikas,

wM didn’t provide any services for HashMap/Hashtable. We are using PSUtilities as Rob told. But, in PSUtilities didn’t find service for clear(), but we have remove method which removes one by one.

Yes we are placing the service in our own package as you told, instead using from PSUtil package. Yes, at last we are doing by dropping HashMap object from pipeline.

Thank you all.