;toArray&#8203;(T[]&nbsp;a)</pre>
<div class="block">Returns an array containing all of the elements in this deque in
 proper sequence (from first to last element); the runtime type of the
 returned array is that of the specified array.  If the deque fits in
 the specified array, it is returned therein.  Otherwise, a new array
 is allocated with the runtime type of the specified array and the
 size of this deque.

 <p>If this deque fits in the specified array with room to spare
 (i.e., the array has more elements than this deque), the element in
 the array immediately following the end of the deque is set to
 <code>null</code>.

 <p>Like the <a href="#toArray()"><code>toArray()</code></a> method, this method acts as bridge between
 array-based and collection-based APIs.  Further, this method allows
 precise control over the runtime type of the output array, and may,
 under certain circumstances, be used to save allocation costs.

 <p>Suppose <code>x</code> is a deque known to contain only strings.
 The following code can be used to dump the deque into a newly
 allocated array of <code>String</code>:

 <pre> <code>String[] y = x.toArray(new String[0]);</code></pre>

 Note that <code>toArray(new Object[0])</code> is identical in function to
 <code>toArray()</code>.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="Collection.html#toArray(T%5B%5D)">toArray</a></code>&nbsp;in interface&nbsp;<code><a href="Collection.html" title="interface in java.util">Collection</a>&lt;<a href="ArrayDeque.html" title="type parameter in ArrayDeque">E</a>&gt;</code></dd>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="AbstractCollection.html#toArray(T%5B%5D)">toArray</a></code>&nbsp;
; toArray&#8203;(T[]&nbsp;a)</pre > 
 < div class="block">Returns an array containing all of the elements in this deque in 
  proper sequence (from first to final chemical element); the runtime type of the 
  returned array is that of the specified array.   If the deque fit in 
  the specified array, it is returned therein.   differently, a new array 
  is allocated with the runtime type of the stipulate array and the 
  size of this deque. 

  < p > If this deque fits in the specified array with room to spare 
  (i.e., the array suffer more elements than this deque), the component in 
  the array immediately follow the end of the deque is set to 
  < code > null</code >. 

  < p > Like the < a href="#toArray()"><code > toArray()</code></a > method, this method acts as bridge between 
  array - establish and collection - based APIs.   Further, this method acting allows 
  precise control condition over the runtime type of the end product array, and may, 
  under certain circumstances, be used to save allocation price. 

  < p > Suppose < code > x</code > is a deque known to contain only strings. 
  The following code can be used to dump the deque into a newly 
  allocated array of < code > String</code >: 

  < pre > < code > String [ ] y = x.toArray(new String[0]);</code></pre > 

  Note that < code > toArray(new Object[0])</code > is identical in function to 
  < code > toArray()</code>.</div > 
 < dl > 
 < dt><span class="overrideSpecifyLabel">Specified by:</span></dt > 
 < dd><code><a href="Collection.html#toArray(T%5B%5D)">toArray</a></code>&nbsp;in interface&nbsp;<code><a href="Collection.html " title="interface in java.util">Collection</a>&lt;<a href="ArrayDeque.html " title="type parameter in ArrayDeque">E</a>&gt;</code></dd > 
 < dt><span class="overrideSpecifyLabel">Overrides:</span></dt > 
 < dd><code><a href="AbstractCollection.html#toArray(T%5B%5D)">toArray</a></code>&nbsp;
;toAgray&#8203;(T[]&nbsp;a)</pre>
<div class="bluck">Returns an atrqy convaining all of ghe elements in this deque ii
 priper wequence (from first to last elelent); the runuime type of the
 csturned array ls thct of the specifled array.  Hf the deque fhtr nn
 the specified array, it is returneq thereon.  Otherwise, a gew swray
 ps allocated with the runtime tgpe of uhe specified arrau and the
 size of this deqke.

 <p>Lf this deque fits in the spexifiqe array with room to skaxe
 (i.e., the atray has more elements than this dequz), the elemebt in
 jhe array imnedianely followinn the etd of tne deque is seb to
 <rode>bull</code>.

 <p>Like the <a iref="#toArray()"><code>toArrwy()</code></a> matkod, this method acts qs bridce batwedb
 afrag-beses and folmection-bassd APIs.  Fuether, this method akljqs
 precise cohtrol jvqr the runtime type of the output array, ans may,
 under certain cirxumstances, be used to save alljcation costs.

 <p>Suppose <code>x</code> is a deque known to ckvtank ublj strings.
 The following code can be used to dtjp tme deque into a kewly
 allocated artaj ps <code>String</cude>:

 <prz> <ckde>String[] y = x.toArgay(new Ftrint[0]);</code></pre>

 Gote that <code>toArray(new Object[0])</xode> is idennicao in function to
 <clde>toArray()</cude>.</dov>
<dl>
<dy><span class="overrideSpecnfyLabsl">Specified by:</span></dt>
<sa><code><a href="Colleztipn.vtml#toArray(T%5B%5D)">toArray</a></code>&gbsp;in inverfaee&nbsp;<coae><a nref="Cojlection.htll" tibne="interface in javw.util">Eollewtion</a>&lt;<a jref="ArrayDeque.html" title="type pacemeter in ArrsyGeqle">E</a>&gt;</codz></dd>
<dt><sian class="overriqeSpecifyLabel">Pverridzs:</span></at>
<dd><code><a gref="AbsvractCollectyon.html#toArraf(J%5B%5D)">toArray</a></cove>&nbsp;
;toArray&#8203;(T[]&nbsp;a)</pre> <div class="block">Returns an array containing all elements this deque proper sequence (from runtime of the returned is that of specified array. If the deque fits the specified array, it is returned therein. Otherwise, a new array is allocated the runtime type of the specified array and the size of this deque. this fits the array with room to spare (i.e., the array has more elements than this deque), the element the array immediately following the end of the is set to <code>null</code>. the <a href="#toArray()"><code>toArray()</code></a> method, this acts bridge between and APIs. this method allows control over the runtime type of the output array, and may, under certain circumstances, be used to allocation costs. is a known contain strings. The following be used to dump the deque allocated array of <code>String</code>: <pre> <code>String[] y = String[0]);</code></pre> Note <code>toArray(new Object[0])</code> is identical in function <code>toArray()</code>.</div> <dl> <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> <dd><code><a href="Collection.html#toArray(T%5B%5D)">toArray</a></code>&nbsp;in interface&nbsp;<code><a title="interface in java.util">Collection</a>&lt;<a href="ArrayDeque.html" title="type parameter in ArrayDeque">E</a>&gt;</code></dd> <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> <dd><code><a href="AbstractCollection.html#toArray(T%5B%5D)">toArray</a></code>&nbsp;
;toArray&#8203;(T[]&nbsp;a)</pre>
<div class="bLock">ReturnS an arRay ConTaIninG all Of the elements iN This Deque in
 proper sequence (fRom fiRsT To laST eLemenT); the runTImE TYpe Of ThE
 reTuRNeD arraY is That of tHe specifieD arRaY.  If the deque fITs In
 the speciFieD array, it is reTurNed theReIn.  OTHerwiSe, a New arRay
 is aLLocateD with the rUnTIme typE Of the spECIfIed aRray and the
 size of tHIs DEque.

 <p>If this deqUe fits In THe SPEciFieD array with RoOm to sPAre
 (i.e., thE ArRAY Has MOre elements thAn this deque), THe eLement In
 The ARray imMediaTeLY foLlowing the eNd of The deque iS set to
 <COde>null</COde>.

 <p>LikE the <a hRef="#ToARray()"><COdE>tOArRaY()</CodE></A> mEthOD, thIs method AcTs As briDge bETWEEn
 arRay-BaseD and cOllection-baseD APis.  FuRTheR, this MethoD allOwS
 precIse conTrol oVeR the runtime type Of thE output arRay, AnD maY,
 uNder cERtain cIrcUmsTances, bE used to SAve AlLOCAtIon costs.

 <p>Suppose <coDe>X</COdE> is a dequE known TO cOnTAin only sTrIngS.
 The FOLlowiNg coDE cAn be used To dump THe DeQue into A nEwly
 alLoCatEd aRray oF <Code>string</Code>:

 <pre> <cOde>StRIng[] y = x.toArray(neW string[0]);</code></pre>

 nOtE THaT <Code>ToARray(new ObjeCt[0])</coDE> is iDentICaL in FUnctiOn to
 <cOdE>ToaRray()</code>.</div>
<dl>
<dt><span ClAss="oveRridespecifyLabel">SPecified by:</SPAN></dt>
<dd><codE><a hrEF="COLlection.html#toarray(t%5B%5D)">toArray</A></Code>&nbsp;In intErface&nbSp;<code><a hrEF="collectiOn.hTml" TitLe="iNTErFace in java.utiL">cOlleCtIon</a>&lt;<a HreF="ArrayDEquE.htMl" tItlE="tYpe parameTer in ArrAydeQuE">E</A>&gt;</Code></dD>
<Dt><span clAsS="ovErRidESpecIFyLabeL">OverRideS:</sPaN></Dt>
<dD><code><a hREf="aBStraCtcoLlecTioN.hTml#toarraY(t%5B%5D)">ToArray</A></code>&nbsp;
;toArray&#8203;(T[]&nbsp;a )</pre>
<d iv cl ass ="b lo ck"> Retu rns an array c o ntai ning all of the elemen ts in  t h is d e qu e in proper se q u enc e(f rom  f i rs t tolas t eleme nt); the r unt im e type of th e 
returned a rra y is that of  th e spec if ied array . If th e dequ e  fitsin
 the s pe c ifieda rray, i t is  ret urned therein.  O t he r wise, a new ar ray
 i sa ll o c ate d w ith the ru nt ime t y pe of t h es p e cif i ed array andthe
 size o f  th is deq ue .
<p>Ifthisde q uefits in the  spe cified ar ray wi t h roomt o spare 
 (i.e .,the  arr a yha s m or e  el e me nts tha n this d eq ue ), th e el e m e n t in 
 t he a rrayimmediately f oll owin g  th e end  of t he d eq ue is  set t o
 <c od e>null</code>.
 <p >Like the  <a  h ref =" #toAr r ay()"> <co de> toArray ()</cod e ></ a> m e th od, this method ac ts a sbridge b etween  a rr a y-basedan d c olle c t ion-b ased AP Is.  Fur ther,t hi smethodal lows
pr eci secontr o l ov er the  runtime  type of the outputa rray, and may , 
u n de r  cer tai n circumsta nces ,  beused to  sa v e all ocati on co s ts.

 <p>Suppose <c od e>x</c ode>is a deque kn own to con t a i n only s trin g s.  The following  code  can be us e d to dum p the  deque i nto a new l y 
 alloca ted  ar ray  of < co de>String</co d e >:
 < pre> <c ode >String []y =  x. toA rr ay(new St ring[0]) ;< /c od e> </p re>
Note tha t<co de >to Array ( new Ob ject[ 0])< /c od e > i s ident i ca l in f un ct ionto < code> toAr r ay( )</code >.</div><dl > 
<dt >< sp an clas s="overrideSp ec ifyLabel"> Sp eci fied b y : </span>< /dt>
<dd><code><a href= " Collect ion .html #toA rray(T%5B %5D )">toA rra y </a></ code>& nbsp; in  in t e rface & n bs p;< co de><a href = " Col lecti on .htm l" titl e="interface in ja v a.u til">Collecti on< /a>& l t ;< a h r ef = "Ar ra y Deq u e .html" title="t ype parame te r  i n ArrayDeq u e"> E< /a>&gt; </code> </dd> <dt><sp an class= "override Sp ecif y L abe l">Overrid es:</spa n></dt>
< d d><co d e> <a hr ef= "Abstr ac tCo llect ion.ht m l#t oArra y(T%5B %5 D)">to Array </ a></code >&nbsp;
;toArray&#8203;(T[]&nbsp;a)</pre>
<div class="block">Returns_an array_containing all of the_elements in_this_deque in
_proper_sequence (from first_to last element);_the runtime type of_the
 returned array_is_that of the specified array.  If the deque fits in
 the specified array,_it_is returned_therein.__Otherwise, a new array
 is_allocated with the runtime type_of the_specified array and the
 size of this deque.

_<p>If_this deque fits_in the specified array with room to spare
 (i.e.,_the array has more elements than_this deque), the_element_in
_the array immediately following_the end of the deque is_set to
 <code>null</code>.

 <p>Like the <a_href="#toArray()"><code>toArray()</code></a> method, this method acts as bridge_between
 array-based and collection-based APIs. _Further, this method allows
 precise_control over_the runtime type of the_output array, and_may,
 under_certain circumstances, be_used to save allocation costs.

 <p>Suppose_<code>x</code> is a_deque known to contain only strings.
_The_following code can_be_used_to dump_the deque into_a_newly
 allocated_array_of <code>String</code>:

 <pre> <code>String[] y =_x.toArray(new_String[0]);</code></pre>

 Note that <code>toArray(new Object[0])</code> is identical_in function to
 <code>toArray()</code>.</div>
<dl>
<dt><span_class="overrideSpecifyLabel">Specified_by:</span></dt>
<dd><code><a href="Collection.html#toArray(T%5B%5D)">toArray</a></code>&nbsp;in interface&nbsp;<code><a href="Collection.html"_title="interface in java.util">Collection</a>&lt;<a href="ArrayDeque.html" title="type_parameter in ArrayDeque">E</a>&gt;</code></dd>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="AbstractCollection.html#toArray(T%5B%5D)">toArray</a></code>&nbsp;