the question is simple – I have to implement JTree TreeModel interface which requires that every object has a number. The tree will represent data that are kept in hashmap/hashtable. Keys in that hashmap are client objects and values are arrays of resources (or ArrayLists) so numbering is only a problem at the top level. What would be the easiest way to number keys in Hashmap/Hashtable?
the question is simple – I have to implement JTree TreeModel interface which requires
Share
But why don’t you just use an
ArrayList? It holds objects by an index, exactly what you need.