2 Star 0 Fork 0

20165203Enosh / 20165203xyx

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
Example15_5.java 973 Bytes
一键复制 编辑 原始数据 按行查看 历史
20165203Enosh 提交于 2018-04-08 19:28 . week6
import java.util.*;
public class Example15_5 {
public static void main(String args[ ]) {
List<Integer> list = new LinkedList<Integer>();
for(int i=10;i<=50;i=i+10)
list.add(new Integer(i));
System.out.println("洗牌前,链表中的数据");
Iterator<Integer> iter=list.iterator();
while(iter.hasNext()){
Integer n=iter.next();
System.out.printf("%d\t",n.intValue());
}
Collections.shuffle(list);
System.out.printf("\n洗牌后,链表中的数据\n");
iter=list.iterator();
while(iter.hasNext()){
Integer n=iter.next();
System.out.printf("%d\t",n.intValue());
}
System.out.printf("\n再向右旋转1次后,链表中的数据\n");
Collections.rotate(list,1);
iter=list.iterator();
while(iter.hasNext()){
Integer n=iter.next();
System.out.printf("%d\t",n.intValue());
}
}
}
Java
1
https://gitee.com/xyx-nice/20165203xyx.git
git@gitee.com:xyx-nice/20165203xyx.git
xyx-nice
20165203xyx
20165203xyx
master

搜索帮助