我如何使用数组随机播放曲目列表
问题描述:
即时尝试将收集的音乐曲目与不确定的音乐曲目如何做到这一点。我如何使用数组随机播放曲目列表
public void Shuffle()
{
Collections ArrayList<Track>;
}
什么我开始用^
答
例
public class Random {
public static void main(String[] args) {
List<String> teamList=Arrays.asList("Ananaya", "Mike","James", "Shashwat");
Collections.shuffle(teamList);
int counter=0;
for (String value:teamList){
System.out.println("The build schedule for week "+ ++counter + " is to be done by "+value);
}
}
}
HTTPS:/ /www.tutorialspoint.com/java/util/collections_shuffle.htm –
可能的重复:http://stackoverflow.com/questions/1519736/random-shuffling-of-an-array – JonSG
有一个名为'shuffle'的'Collections'类有一个静态方法。尝试将您的列表传递给该方法。 – marstran