Thanks, Dave!
I've never used Java before Processing (and I've only used Processing for a day), but I poked around a bit and couldn't immediately see how to use anything other than String key/value pairs in Processing.
<googles>
Sun's documentation for the HashMap class defines the params for HashMap.Put() as such: Object key, Object value, so I assume that when your example, above, uses Strings, some sort of implicit coercion is occurring or perhaps Java's strings are objects and Integers are primitive types (not objects).
<fiddles>
Let's try this:
Code:
import java.util.HashMap;
import java.lang.Number;
HashMap hm = new HashMap();
hm.put(new Integer(7),new Integer(10));
println(hm.get(new Integer(7)));
Well, storing the Integer works when I wrap it in an Integer object, but that seems pretty circuitous. Even doing the following to coerce Integers to Strings:
Code:
hm.put(str(7),str(10));
println(hm.get(str(7)));
Leaves me a bit concerned about performance -- I'm hoping there is an easier way, perhaps there is a Java class that will store Integer/Integer key/value pairs or Integer/Object key/value pairs. Perhaps I will have to roll my own Dictionary/HashMap class?
Thanks,
John B.