209 |
|
*/ |
210 |
|
public ArrayDeque(Collection<? extends E> c) { |
211 |
|
this(c.size()); |
212 |
< |
addAll(c); |
212 |
> |
copyElements(c); |
213 |
|
} |
214 |
|
|
215 |
|
/** |
325 |
|
final int s, needed; |
326 |
|
if ((needed = (s = size()) + c.size() + 1 - elements.length) > 0) |
327 |
|
grow(needed); |
328 |
< |
c.forEach(this::addLast); |
328 |
> |
copyElements(c); |
329 |
|
// checkInvariants(); |
330 |
|
return size() > s; |
331 |
|
} |
332 |
|
|
333 |
+ |
private void copyElements(Collection<? extends E> c) { |
334 |
+ |
c.forEach(this::addLast); |
335 |
+ |
} |
336 |
+ |
|
337 |
|
/** |
338 |
|
* Inserts the specified element at the front of this deque. |
339 |
|
* |