mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8197531: Miscellaneous changes imported from jsr166 CVS 2018-04
Reviewed-by: martin, psandoz
This commit is contained in:
parent
a4f3a1d9eb
commit
cdd36df363
27 changed files with 194 additions and 34 deletions
|
@ -208,7 +208,7 @@ public class ArrayDeque<E> extends AbstractCollection<E>
|
|||
*/
|
||||
public ArrayDeque(Collection<? extends E> c) {
|
||||
this(c.size());
|
||||
addAll(c);
|
||||
copyElements(c);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -322,10 +322,14 @@ public class ArrayDeque<E> extends AbstractCollection<E>
|
|||
final int s, needed;
|
||||
if ((needed = (s = size()) + c.size() + 1 - elements.length) > 0)
|
||||
grow(needed);
|
||||
c.forEach(this::addLast);
|
||||
copyElements(c);
|
||||
return size() > s;
|
||||
}
|
||||
|
||||
private void copyElements(Collection<? extends E> c) {
|
||||
c.forEach(this::addLast);
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts the specified element at the front of this deque.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue