lundi 4 juin 2018

Java - Check for x alike integers in a list of integers

I'd like to go through a list of integers and make action if I find 6 integers that are alike, or another if there is 5 alike, or another if there is 4 alike etc...How can I do this. I have the method:

public int calculatePoints(ArrayList<Integer> dice) {
    //Check for 6 alike
    //if not, check for 5 alike
    //if not, check for 4 alike
}

Aucun commentaire:

Enregistrer un commentaire