LinkedList的构造函数有哪些

 LinkedList构造函数有(两种):

  1. public LinkedList()
  2. public LinkedList(Collection<? extends E> c)
/**
     * Constructs an empty list.
     */
    public LinkedList() {
    }

    /**
     * Constructs a list containing the elements of the specified
     * collection, in the order they are returned by the collection's
     * iterator.
     *
     * @param  c the collection whose elements are to be placed into this list
     * @throws NullPointerException if the specified collection is null
     */
    public LinkedList(Collection<? extends E> c) {
        this();
        addAll(c);
    }

 

posted @ 2018-11-13 01:01  胡金水  阅读(1181)  评论(0编辑  收藏  举报