Java 实例 - List 循环移动元素
Java 教程
· 2019-02-11 18:13:17
以下实例演示了如何使用 Collections 类的 rotate() 来循环移动元素,方法第二个参数指定了移动的起始位置:
Main.java 文件
import java.util.*;
public class Main {
public static void main(String[] args) {
List list = Arrays.asList("one Two three Four five six".split(" "));
System.out.println("List :"+list);
Collections.rotate(list, 3);
System.out.println("rotate: " + list);
}
}
以上代码运行输出结果为:
List :[one, Two, three, Four, five, six] rotate: [Four, five, six, one, Two, three]
点击查看所有 Java 教程 文章: https://codercto.com/courses/l/12.html
PHP and MySQL Web Development
Luke Welling、Laura Thomson / Sams / July 25, 2007 / $49.99
Book Description PHP and MySQL Web Development teaches you to develop dynamic, secure, commerical Web sites. Using the same accessible, popular teaching style of the three previous editions, this b......一起来看看 《PHP and MySQL Web Development》 这本书的介绍吧!
XML、JSON 在线转换
在线XML、JSON转换工具
HEX HSV 转换工具
HEX HSV 互换工具