I am making a plugin for my server which allows players to switch the map. It's currently written with these logic steps: Integer: map1 Arraylist<int> votedmaps; 1) command: adds 1 to map1, and adds map1 to votedmaps 2) check: if nothing in the arraylist, don't change the map 3) else: find largest value in arraylist The problem is with step 3. I am able to find the largest value in the arraylist, but I am not able to find which map it's associated with. Also, it doesn't work well for ties between maps. Could someone point me in the right direction? Thanks!