Let $X = \bigcup_{i=1}^\infty X_i$ and $Y=\bigcup_{j=1}^\infty Y_j$ such that $X_i$ is homeomorphic to $Y_j$ whenever $i=j$. Then is it true that $X$ is homemorphic to $Y$? If yes, then how do we see this homoemorphism? If not, then what is the problem?
I think the answer to the above question should be yes, but then, in general, $Y$ itself might not be a topological space, since the union of topological spaces need not be a topological space.
Context: I have a topological space $X$ with Zariski topology, and I can write is as countable union $X=\bigcup_{i=1}^\infty X_i$. Then I can prove that each $X_i$ is homeomorphic to a topological space $Y_i$ with Zariski topology. From this can I conclude that $X$ is homeomorphic to $\bigcup_{j=1}^\infty Y_j$? If yes, then what exactly is the homeomorphism? How do we define the topology on this union $\bigcup_{j=1}^\infty Y_j$, since we know that union of topological spaces need not be a topological space?
The Zariski topology on $X=\mathrm{Spec}(A)$ is defined as the topology in which the closed sets are $V(I) = \{P\in \mathrm{Spec}(A): I\subset P\}$ where $P$ is a prime ideal and $I$ is an ideal of the commutative ring $A$.
Let $X_i=(-i,0)$ when $i$ is even and $(0,i)$ when $i$ is odd. Let $Y_i=(-i,i)$ for all $i$. Then each $X_i$ and $Y_i$ are clearly homeomorphic (they are translates of each other). But $X=\cup_i X_i=(-\infty,0) \cup (0,\infty)$ and $Y=\cup_i Y_i=(-\infty,\infty)=\mathbb{R}$ and $X_i \not\cong Y_i$ since the latter is connected and the former is not.
The issue is that the topology of the union can have different properties than that of the individual topologies of the pieces making it up. Indeed, the topology of the $X_i$ and $Y_i$ can have nothing to do with the topology of the union. My example was chosen so that there was some way to make sense of the topology of the union but there is no canonical way of doing so generally (insofar as I am aware).