I have a method which looks like so...
public static ArrayList<Integer> bettingCycle(
ArrayList<Integer> playersRemaining,
String[][] playerHands,
ArrayList<Integer> bets,
int totalPot) {
//irrelevant code
return playersRemaining;
}
My method successfully returns the adjusted ArrayList playersRemaining, but does not alter any of the passed in variables (playerHands, bets, totalPot).
In order for my program to work, I need to somehow adjust the playerHands, bets and totalPot passed in variables. No matter what I've tried, I still can't get anything, other than the returned playersRemaining
to change.
To help explain what I desire to be accomplished, here's an example with comments attached to help explain my problem.
public static ArrayList<Integer> playHand(
ArrayList<Integer> initialPlayers,
String[][] initialPlayerHands,
ArrayList<Integer> preliminaryBets //assumed to be initially 0's
int initialPot //also assumed to be initially 0
)
{
//fancy code that allows for initial betting cycle (so that the values
//passed into the bettingCycle method are not null, or invalid
//It is here that the values are initially changed before passing to the
//bettingCycle
if (!allPlayersCalled) {
bettingCycle(updatedPlayersRemaining, updatedPlayerHands,
updatedBets, updatedTotalPot);
//when I call this, only the
//updatedPlayersRemaining changes,
//but none of the other variables.
//I'd like for bettingCycle() to also change the other passed in
//variable, so I can use the changed even further along in the method
}
return updatedPlayersRemaining;
}
Any thoughts as to how to change the passed in variables, so they can be adjusted appropriately?