3
How to do not repeat data at each run?
Each time I Run, he ends up repeating the dates at the time of execution, as I do for Him to draw the dates without repeating them, and when he finishes the number of dates available on this Collection he displays a message that the options are over?
package DeclaracaoArray;
import java.util.List;
import java.util.ArrayList;
import java.util.Collections;
public class Declaracao_Array {
public static void main(String[] args) {
Declaracao_Array d = new Declaracao_Array();
System.out.println(d.data());
}
public String data (){
List<String> lista = new ArrayList<String>();
lista.add ( "01/09/2015" );
lista.add ( "02/09/2015" );
lista.add ( "03/09/2015");
lista.add ( "04/09/2015");
lista.add ( "08/09/2015" );
lista.add ( "09/09/2015" );
lista.add ( "10/09/2015");
lista.add ( "11/09/2015");
lista.add ( "14/09/2015" );
lista.add ( "15/09/2015" );
lista.add ( "17/09/2015");
lista.add ( "18/09/2015");
lista.add ( "21/09/2015" );
lista.add ( "22/09/2015" );
lista.add ( "23/09/2015");
Collections.shuffle ( lista );
return lista.get(0);
}
}
What do you mean
não repetir os dados a cada execução
?– Jéf Bueno
Do not repeat data from a new list ?
– Thiago Friedman
I’ll edit the question, it’s vague... I’m sorry.
– Paulo Roberto
The
shuffle()
is not shuffling?– Franchesco
@jsantos1991 worked, put as a response I will vote for her.
– Paulo Roberto