LinkedList的建構函式有哪些
阿新 • • 發佈:2018-11-13
LinkedList建構函式有(兩種):
-
public LinkedList()
-
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); }