提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
Java为每个
import java.util.*;/*时 代 J a v a 公 众 号*/ public class Ran { public static void main(String[] args) { // Get and shuffle the list of arguments List<String> argList = Arrays.asList(args); Collections.shuffle(argList); // Print out the elements using JDK 8 Streams argList.stream() .forEach(e->System.out.format("%s ",e)); // Print out the elements using for-each for (String arg: argList) { System.out.format("%s ", arg); } System.out.println(); } }/** 来 自 N o w J a v a . c o m**/