I have tried using the Hashmap data structure to create an associative array in processing with objects as values and, of course, strings as keys.
http://processing.org/reference/HashMap.html
However, I couldn't get the values of my hash map to be objects of a class I made.
Here is what I tried:
class Person {
public String firstName, lastName;
Person(String f, String l) {
this.firstName = f;
this.lastName = l;
}
}
HashMap<Person> persons;
persons = new HashMap();
Processing returns a bizarre error:
Cannot find anything named "persons"
HashMap<Person> persons = new HashMap()<Person>; and then access by persons.get("index here");