I want to generate a complex of connected rooms. Every room can have 1-4 rooms next to it.

![Room complex](https://i.stack.imgur.com/lOaGo.jpg)

My algorythm generates this complex of connected rooms.

```
public class Room
{
    private Room top = null; //Connected rooms
    private Room right = null;
    private Room bottom = null;
    private Room left = null;
    private Vector2 roomOffset; //Position of the room
}

```

Before creating a new room I want to check if there is already a room at the position of the new room. Is there an easier way than going through all rooms and checking if the position matches the position of the new room?