と比較したいのですが、オブジェクトArrayを持つArrayListがあります。 質問は次のとおりです。**私は、arraylistのオブジェクトPlayerの配列の**要素を他の配列と比較したいと思います。ArrayList <Player>の配列内のすべての要素をint []配列
//Method that calculates no of right rows and puts it to the player
public static void NoOfRights(ArrayList<Player> a, int[] b){
int count = 0;
for(int i = 0; i < a.size(); i++){
Player player = a.get(i);
for(int j = 0; j < player.getRows();j++) {
boolean isEqual = isEquals(player.getRows(j), b, 7);
if(isEqual == true){
count++;
}
if(count == 7){
player.noOf7right(count);
}
else if(count == 6){
player.noOf6right(count);
}
else if(count == 5){
player.noOf5right(count);
}
のisEqualメソッドです:
private static boolean isEquals(int[] j, int[] b, int size) {
for(int i = 0; i<size; i++) {
if(j[i] == b[i]) {
return true;
}
}
return false;
}
.getRows()である
この
が、これはこれまでのところ、比較のために私のコードで私のクラスのプレーヤーpublic class Player{
private String name;
private int bet;
private ArrayList <int []> lottorows;
ですプレーヤーの方法:
public int[] getRows(int a){
return lottorows.get(a);
}
私はあなたの助けに感謝します! ありがとうございました
何が問題なのですか? –
具体的な問題を明確にしたり、詳細を追加して必要なものを正確に強調してください。現在書かれているとおり、あなたが求めていることを正確に伝えるのは難しいです。この質問を明確にする方法については、How to Askページを参照してください。 –
Playerが他の配列と保持している要素を比較したい。 – JohnBanana