提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
集合方法排序。
import java.util.List; import java.util.Arrays; import java.util.Collections; /*来自 N o w J a v a . c o m - 时代Java*/ public class Main { public static void main(String[] args) { String[] suits = {"Hearts", "Diamonds", "Clubs", "Spades"}; // Create and display a list containing the suits array elements List<String> list = Arrays.asList(suits); System.out.printf("Unsorted array elements: %s%n", list);