Skip to content

Instantly share code, notes, and snippets.

@mvberg
Created December 10, 2013 18:34
Show Gist options
  • Save mvberg/7895635 to your computer and use it in GitHub Desktop.
Save mvberg/7895635 to your computer and use it in GitHub Desktop.
VisualVM Object Query for HashMap that prints their key->value entries.
select map(heap.objects('com.barchart.osgi.factory.api.util.Props'),
function (it) {
var res = '';
var tables = toArray(it.table);
for(i = 0;i< tables.length;i++) {
var e = tables[i];
while(e != null) {
if(e.key != null) {
res += e.key.toString();
}else {
res += 'nullKey';
}
if(e.value!= null) {
res += " -> " + toHtml(e.value.toString());
}else {
res += " -> null";
}
res += "<br/>";
e = e.next;
}
}
return res + "<br>";
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment