if (tileInstanceProperties[i][j] != null) { clone.tileInstanceProperties[i][j] = new Properties(tileInstanceProperties[i][j]);
Properties p = getTileInstancePropertiesAt(i, j);  if (p != null) { Integer key = new Integer(i + j * bounds.width); clone.tileInstanceProperties.put(key, p.clone());
    public Object clone() throws CloneNotSupportedException {        TileLayer clone = (TileLayer) super.clone();        // Clone the layer data        clone.map = new Tile[map.length][];        clone.tileInstanceProperties = new Properties[map.length][];        for (int i = 0; i < map.length; i++) {            clone.map[i] = new Tile[map[i].length];            System.arraycopy(map[i], 0, clone.map[i], 0, map[i].length);            clone.tileInstanceProperties[i] = new Properties[map[i].length];            for (int j = 0; j < map[i].length; j++) {                if (tileInstanceProperties[i][j] != null) {                    clone.tileInstanceProperties[i][j] = new Properties(tileInstanceProperties[i][j]);                }            }        }        return clone;    }