Removing ArraList Elements in a Method
<p>[EDIT]Fairly new to the site so editted to try to clarify the problem.</p>

<p>I am working on a project where I have a method in which one of the parameters is an array.</p>

<p>Example:</p>

<pre><code>public class Match

public void playMatch(int teamA, int teamB, ArrayList&lt;String&gt; groups)
Random scoreA = new Random();
int score1 = scoreA.nextInt(5) + 0;
int score2 = scoreA.nextInt(5) + 0;
System.out.println("Qtr 1: " + score1 + "   " + score2);

if (score1 &gt; score2){
    System.out.println(groups.get(teamA) + " win " + score1 + " to +   
    score2 + " " + teams.get(teamB) + " eliminated.");
            teams.remove(teamB);
}
else if (score2 &gt; score1){
    System.out.println(groups.get(teamB) + " win " + score2 + " to " +  
    score11 + " " + teams.get(teamA) + " eliminated.");
            teams.remove(teamA);}
}
public static void main(String[] args) {
Match game1 = new Match();
ArrayList&lt;String&gt; groups = new ArrayList&lt;String&gt;(
            Arrays.asList("team1", "team2", "team3"));
System.out.println("Round 1");
game1.playMatch(0, 1, groups);
</code></pre>

<p>The problem is that when I remove the element in my Matches method it does not remove it from the ArrayList in my main method. This is an issue because I want to be able to then do:</p>

<p><code>game2.playMatch(0, 1, groups)</code></p>

<p>Where 1 = team3 instead of team 2.</p>

<p>How can I make it so that when I remove an element from the Array in my Matches method it actually will remove that element from the Array in my main method? Is this even possible? I would prefer to have something that fits into my code if it is possible and i don't want to have to implement another method if I don't have to as there is actually a lot more than this but this gives the jist of what I want to have happen. </p>