That's how I'm loading the tilemaps, yes. That's no issue. I think loading the actual objects through a file would work well, too. Let me refine my example to explain the issue a little better.
I have a key class. In my file, if there is a key on a tile, I'll place a 1 on it.
Now, I go to parse the file, and I come across a 1. So, my parser creates a new key (via new Key()
I come across another 1, and do new Key(); again.
How would I assign doors to these keys, considering my parser is creating the objects? Basically, how do I differentiate 2 different instances of the same class? I figure an ID, but how can my parser assign these ID's? And in my opinion for the door, rather than giving the key a door object, the key and door just need to have the same "key code" (A number that has to match).