package com.sf._03_collections;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class Test2 {
    public static void main(String[] args) {
        /**
         * 替换api
         * replaceAll(list,oldValue,newValue)
         * List = {1,2,3,3,4,5}
         * 把集合当中3 替换成 30
         */
        List<Integer> list = new ArrayList<>(Arrays.asList(1,2,3,3,4,5));
        System.out.println(list);
        Collections.replaceAll(list,3,30);
        System.out.println(list);


        /**
         * 反转集合reverse()
         */
        Collections.reverse(list);
        System.out.println(list);

        /**
         * shuff():
         * 打乱顺序
         */
        Collections.shuffle(list);
        System.out.println(list);
    }
}
