To merged Charts

import java.util.ArrayList;
import java.util.LinkedList;

public class TestTwo {
    //To merged Charts:
    //The code is as follows:
    public static void main(String[] args) {
        //ArrayList:
        ArrayList<Integer> Fir=new ArrayList<>();
        Fir.add(5);
        Fir.add(2);
        Fir.add(0);
        ArrayList<Integer> Sec=new ArrayList<>();
        Sec.add(6);
        Sec.add(0);
        Sec.add(2);
        Sec.add(5);
        ArrayList<Integer> merge =new ArrayList<>();
        merge.addAll(Fir);
        merge.addAll(Sec);
        System.out.println("Fir:"+Fir);
        System.out.println("Sec:"+Sec);
        System.out.println("merge:"+merge);
        //LinkedList:
        LinkedList<Integer> Thi=new LinkedList<>();
        Thi.add(6);
        Thi.add(6);
        Thi.add(6);
        LinkedList<Integer> Fiv=new LinkedList<>();
        Fiv.add(8);
        Fiv.add(8);
        Fiv.add(8);
        LinkedList<Integer> merged=new LinkedList<>();
        merged.addAll(Thi);
        merged.addAll(Fiv);
        System.out.println("Thi:"+Thi);
        System.out.println("Fiv:"+Fiv);
        System.out.println("merged:"+merged);
    }

}
The results are as follows:
Show results:
Fir:[5, 2, 0]
Sec:[6, 0, 2, 5]
merge:[5, 2, 0, 6, 0, 2, 5]
Thi:[6, 6, 6]
Fiv:[8, 8, 8]
merged:[6, 6, 6, 8, 8, 8]

Process finished with exit code 0

上一篇:2022-2-5动态规划day9


下一篇:tidb执行计划--三