Possible Duplicate:
Determining if an Object is of primitive type
This may sound moronic, but please forgive me, I'm working with moronic code. What is the best way, given a collection of objects, to identify which are primitives, or more accurately, wrappers around primitives.
Suppose I want to print all primitives:
HashMap<String,Object> context = GlobalStore.getContext(); // Some bizarre, strangely populated context
for(Entry<String,Object> e : context.entrySet()){
if(e.value() instanceof PRIMITIVE){ // What goes here?
System.out.println(e);
}
}
Is this possible, other than by enumerating all primitives one by one?