Collision between different maps (2d lwjgl)

Ok just to start off, I don’t know if this is the right place to post what I’m asking, but oh well.

So, I have started learning lwjgl (working on 2d game), and I found an issue with collision. I’m using a layout as follows:

GameMain (Driver)

MenuScreen(Play Button)

FirstLevel (the first level of the game)

and then the various Players and Enemies, which all inherit an abstract Entity class.

In the FirstLevel, I create an arraylist to store every object. Then, for collision I just directly access it through each player/enemy (public arraylist).

The issue I’m having is, since I can’t pass the arraylist by reference in java… but only by value (I think), I have to hardcode FirstLevel.arraylistname in my player class and all the enemy classes. This creates an issue for multiple levels, because I would then have to rehardcode all of my other objects to use the SecondLevel.arraylistname.

So my question is, is there a better way to get every object on the screen, or check collision? I just run a check whenever an object tries moving.

So like, if my player tries moving 10 pixels forward, it checks if that spot collides with any other object (using rectangles and looping through the arraylist).

I’m just learning how games really should work in lwjgl, so if I’m doing something the wrong way please let me know. I just don’t know what to do for checking every object, since the examples I’ve found have said to make layers in each level, but that brings me to the same issue.

Also I could provide code, but I wouldn’t know exactly what file to post as I use like 10+ files atm. If you want to see something, please just let me know.