public class Collections01 {
// Arrays.deepEquals 深入到堆空间比较各个值
// * Arrays.asList 快速生成一个集合
@Test
public void arraysTest(){
List<String> list = Arrays.asList("张三", "李四", "王五");
System.out.println(list);
Integer[] ints1 = {110, 120, 130, 140};
Integer[] ints2 = {110, 120, 130, 140};
System.out.println(ints1 == ints2);
System.out.println(Arrays.deepEquals(ints1, ints2));
}
@Test
public void collectionsTest(){
// max min
// * reverse(倒存数据) shuffle(洗牌数据)
List<Integer> scoreList = Arrays.asList(750, 740, 734, 760);
Integer max = Collections.max(scoreList);
System.out.println("max = " + max);
// Collections.min();
System.out.println("执行方法之前:" + scoreList);
// 将集合中的数据倒着存放
Collections.reverse(scoreList);
System.out.println(scoreList);
// 将集合中的数据 洗牌
Collections.shuffle(scoreList);
System.out.println(scoreList);
}
}