📜  arraylist 到linkedlist java 代码示例

📅  最后修改于: 2022-03-11 14:52:45.982000             🧑  作者: Mango

代码示例1
import java.util.ArrayList;
import java.util.LinkedList;

public class Main {
    public static void main(String[] args){
        ArrayList arrList = new ArrayList<>();
        arrList.add("Mango");
        arrList.add("Apple");
        arrList.add("Orange");
        System.out.println(arrList);
        // ArrayList to LinkedList
        LinkedList linkList = new LinkedList<>(arrList);
        System.out.println("Linked List:");
        System.out.println(linkList);
    }
}