I started a 2D Tilegame programmed with libgdx which needs potentially infinite tiles. That means when the player arrives the border of the map it should be possible to generate even more tiles. So a simple 2D Array is not the best datastructure for that purpose. A better solution I found here in the comments from dlras2: A way to store potentially infinite 2D map data?
it seems like he put 2D arrays in 2D arrays and that again and again, that reduces a lot of memory compared to one array for all tiles:
The problem is that I dont know before how many times the arrays will be encapsulated so it should be easily possible to wrap a new Array around if it is needed.
dlras2 also posted his code in C#, but I dont understand anything from it. Do you have an idea how to implement such a datastructure of recursive Arrays in Java? Or how to translate the whole C# code into Java? I hope the other stuff like putting tiles in the right array I'll solve by my selve.