随机访问RandomAccess

本文系转载
<wbr style="line-height:25px"><span style="color:#ff00ff; line-height:25px">RandomAccess</span><span style="color:#003366; line-height:25px">接口是List实现所使用的标记接口,用来表明其支持快速(通常是固定时间)随机访问。<br style="line-height:25px"> 此接口的主要目的是允许一般的算法更改其行为,从而在将其应用到随机或连续访问列表时能提供良好的性能<wbr style="line-height:25px">。</wbr></span><br style="line-height:25px"> 在对List特别的遍历算法中,要尽量来判断是属于<span style="color:#000080; line-height:25px"><wbr style="line-height:25px">RandomAccess</wbr></span><wbr style="line-height:25px">(如ArrayList)还是<wbr style="line-height:25px"><span style="color:#000080; line-height:25px">SequenceAccess</span><wbr style="line-height:25px">(如LinkedList),<br style="line-height:25px"> 因为适合RandomAccessList的遍历算法,用在SequenceAccessList上就差别很大,<br style="line-height:25px"> 即对于实现了<span style="color:#000080; line-height:25px">RandomAccess</span>接口的类实例而言,此循环<br style="line-height:25px"><span style="color:#0000ff; line-height:25px">for(inti=0,i&lt;list.size();i++)<br style="line-height:25px"> list.get(i);</span><br style="line-height:25px"> 的<wbr style="line-height:25px">运行速度要快<wbr style="line-height:25px">于以下循环:<br style="line-height:25px"><span style="color:#0000ff; line-height:25px">for(Iteratori=list.iterator();i.hasNext();)<br style="line-height:25px"> i.next();</span><br style="line-height:25px"> 实现了RandomAccess接口的有:<br style="line-height:25px"><span style="color:#0000ff; line-height:25px">ArrayList,AttributeList,CopyOnWriteArrayList,RoleList,RoleUnresolvedList,Stack,Vector</span><br style="line-height:25px"> 通过下面的代码,大家可以加深理解。<br style="line-height:25px"><span style="color:#3366ff; line-height:25px">packagecom.bokee.lzqdiy;</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">importjava.util.ArrayList;</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">importjava.util.Iterator;</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">importjava.util.LinkedList;</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">importjava.util.List;</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">importjava.util.RandomAccess;</span><br style="line-height:25px"><span style="color:#993300; line-height:25px">publicclass</span><span style="color:#3366ff; line-height:25px"></span><span style="color:#ff6600; line-height:25px">Test</span><span style="color:#3366ff; line-height:25px">{<br style="line-height:25px"></span><span style="color:#993300; line-height:25px">publicstaticvoid</span><span style="color:#3366ff; line-height:25px">travel(Listlist)<br style="line-height:25px"> {<br style="line-height:25px"></span><span style="color:#993300; line-height:25px">if</span><span style="color:#3366ff; line-height:25px">(listinstanceofRandomAccess)<br style="line-height:25px"> {<br style="line-height:25px"> System.out.println("实现了RandomAccess接口,不使用迭代器!");<br style="line-height:25px"></span><span style="color:#993300; line-height:25px">for</span><span style="color:#3366ff; line-height:25px">(inti=0;i&lt;list.size();i++)<br style="line-height:25px"> {<br style="line-height:25px"> System.out.println(list.get(i));<br style="line-height:25px"> }<br style="line-height:25px"> }<br style="line-height:25px"></span><span style="color:#993300; line-height:25px">else</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">{</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">System.out.println("没实现RandomAccess接口,使用迭代器!");</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px"></span><span style="color:#993300; line-height:25px">for</span><span style="color:#3366ff; line-height:25px">(Iteratoriter=list.iterator();iter.hasNext();)</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">{</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">System.out.println((String)iter.next());</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">}</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">}</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">}</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px"></span><span style="color:#993300; line-height:25px">publicstaticvoid</span><span style="color:#3366ff; line-height:25px"></span><span style="color:#ff6600; line-height:25px">main</span><span style="color:#3366ff; line-height:25px">(String[]args)</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">{</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">Listlist=newArrayList();</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">list.add("a");</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">list.add("b");</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">travel(list);</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">list=newLinkedList();</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">list.add("c");</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">list.add("d");</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">travel(list);</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">}</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">}</span><br style="line-height:25px"> 补充:(2007年4月23日)<br style="line-height:25px"> 下面的程序用来测试ArrayList和LinkedList遍历方式的不同对性能(执行时间)的影响。<br style="line-height:25px"><span style="color:#3366ff; line-height:25px">packagenet.blogjava.lzqdiy;</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">importjava.util.ArrayList;</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">importjava.util.Iterator;</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">importjava.util.LinkedList;</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">importjava.util.List;</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">importjava.util.RandomAccess;</span><br style="line-height:25px"><span style="color:#993300; line-height:25px">publicclass</span><span style="color:#3366ff; line-height:25px"></span><span style="color:#ff6600; line-height:25px">TestDifferent</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">{</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px"></span><span style="color:#993300; line-height:25px">publicstaticvoid</span><span style="color:#3366ff; line-height:25px"></span><span style="color:#ff6600; line-height:25px">main(</span><span style="color:#3366ff; line-height:25px">String[]args)</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">{</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px"></span><span style="color:#993300; line-height:25px">if</span><span style="color:#3366ff; line-height:25px">(args.length==0)</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">{</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">System.err.println("请输入元素的个数和遍历次数!");</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">return;</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">}</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">intnumber=Integer.parseInt(args[0])</span><span style="color:#808080; line-height:25px">;//集合中元素的个数</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">intcount=Integer.parseInt(args[1]);</span><span style="color:#808080; line-height:25px">//遍历集合中元素的次数</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">Listlist=newArrayList();</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">addObject(list,number);</span><span style="color:#808080; line-height:25px">//向集合中添加number个元素</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">System.out.println("遍历ArrayList");</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">travelwithoutIterator(list,count);</span><span style="color:#808080; line-height:25px">//不用迭代器遍历</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">travelwithIterator(list,count);</span><span style="color:#808080; line-height:25px">//用迭代器遍历</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">list=newLinkedList();</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">addObject(list,number);</span><span style="color:#808080; line-height:25px">//向集合中添加number个元素</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">System.out.println("遍历LinkedList");</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">travelwithoutIterator(list,count);</span><span style="color:#808080; line-height:25px">//不用迭代器遍历</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">travelwithIterator(list,count);</span><span style="color:#808080; line-height:25px">//用迭代器遍历</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">}</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px"> </span><span style="color:#993300; line-height:25px">publicstaticvoid</span><span style="color:#3366ff; line-height:25px">addObject(Listlist,intn)</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">{</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">f</span><span style="color:#993300; line-height:25px">or</span><span style="color:#3366ff; line-height:25px">(intm=1;m&lt;=n;m++)</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">{</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">list.add(""+m);</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">}</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">}</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px"></span><span style="color:#993300; line-height:25px">publicstaticvoid</span><span style="color:#3366ff; line-height:25px">travelwithoutIterator(Listlist,intcount)</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">{</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">longstartTime;</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">longendTime;</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">startTime=System.currentTimeMillis();</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px"></span><span style="color:#993300; line-height:25px">for</span><span style="color:#3366ff; line-height:25px">(inta=1;a&lt;=count;a++)</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">{</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px"></span><span style="color:#993300; line-height:25px">for</span><span style="color:#3366ff; line-height:25px">(inti=0;i&lt;list.size();i++)</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">{</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">list.get(i);</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">}</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">}</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">endTime=System.currentTimeMillis();</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">longinterval=endTime-startTime;</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">System.out.println("不使用迭代器的间隔时间:"+interval);</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">}</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px"></span><span style="color:#993300; line-height:25px">publicstaticvoid</span><span style="color:#3366ff; line-height:25px">travelwithIterator(Listlist,intcount)</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">{</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">longstartTime;</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">longendTime;</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">startTime=System.currentTimeMillis();</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px"></span><span style="color:#993300; line-height:25px">for</span><span style="color:#3366ff; line-height:25px">(inta=1;a&lt;=count;a++)</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">{</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px"></span><span style="color:#993300; line-height:25px">for</span><span style="color:#3366ff; line-height:25px">(Iteratoriter=list.iterator();iter.hasNext();)</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">{</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">iter.next();</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">}</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">}</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">endTime=System.currentTimeMillis();</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">longinterval=endTime-startTime;</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">System.out.println("使用迭代器的间隔时间:"+interval);</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">}</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px"></span><span style="color:#993300; line-height:25px">publicstaticvoid</span><span style="color:#3366ff; line-height:25px">travel(Listlist,intcount)</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">{</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">longstartTime;</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">longendTime;</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px"></span><span style="color:#993300; line-height:25px">if</span><span style="color:#3366ff; line-height:25px">(listinstanceofRandomAccess)</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">{</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">System.out.println("实现了RandomAccess接口,不使用迭代器!");</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">startTime=System.currentTimeMillis();</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">for(inta=1;a&lt;=count;a++)</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">{</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">for(inti=0;i&lt;list.size();i++)</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">{</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">list.get(i);</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">}</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">}</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">endTime=System.currentTimeMillis();</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">longinterval=endTime-startTime;</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">System.out.println("间隔时间:"+interval);</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">}</span><span style="color:#993300; line-height:25px">else</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">{</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">System.out.println("没实现RandomAccess接口,使用迭代器!");</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">startTime=System.currentTimeMillis();</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px"></span><span style="color:#993300; line-height:25px">for</span><span style="color:#3366ff; line-height:25px">(inta=1;a&lt;=count;a++)</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">{</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">for(Iteratoriter=list.iterator();iter.hasNext();)</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">{</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">iter.next();</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">}</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">}</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">endTime=System.currentTimeMillis();</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">longinterval=endTime-startTime;</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">System.out.println("间隔时间:"+interval);</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">}</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">}</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">}</span><br style="line-height:25px"> 我在命令行输入:javaTestDifferent10010000<br style="line-height:25px"> 输出结果是:<br style="line-height:25px"><span style="color:#3366ff; line-height:25px">遍历ArrayList<br style="line-height:25px"> 不使用迭代器的间隔时间:31<br style="line-height:25px"> 使用迭代器的间隔时间:63<br style="line-height:25px"> 遍历LinkedList<br style="line-height:25px"> 不使用迭代器的间隔时间:93<br style="line-height:25px"> 使用迭代器的间隔时间:32</span><br style="line-height:25px"> 以上结果随着JVM的运行环境而变化。<br style="line-height:25px"> 当元素个数&gt;100并且遍历次数大于10000次时效果明显。<br style="line-height:25px"> 实例2:<br style="line-height:25px"><span style="color:#3366ff; line-height:25px">importjava.util.ArrayList;</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">importjava.util.Iterator;</span><br style="line-height:25px"><span style="color:#993300; line-height:25px">publicclass</span><span style="color:#3366ff; line-height:25px"></span><span style="color:#ff6600; line-height:25px">Test</span><span style="color:#3366ff; line-height:25px">{</span><br style="line-height:25px"><span style="color:#808080; line-height:25px">/**<br style="line-height:25px"> *@paramargs<br style="line-height:25px"> */</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px"></span><span style="color:#993300; line-height:25px">publicstaticvoid</span><span style="color:#3366ff; line-height:25px"></span><span style="color:#ff6600; line-height:25px">main</span><span style="color:#3366ff; line-height:25px">(String[]args){</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">ArrayList&lt;String&gt;list=newArrayList&lt;String&gt;(10000);</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">for(inti=0;i&lt;10000;i++)</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">list.add(""+System.currentTimeMillis());</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">intcount=1000;</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">longtimeStart=System.currentTimeMillis();</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">longtimeEnd=0;</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">Stringname=null;</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">intk=0;</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px"></span><span style="color:#993300; line-height:25px">for</span><span style="color:#3366ff; line-height:25px">(inta=1;a&lt;=count;a++)</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">{</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px"></span><span style="color:#993300; line-height:25px">for</span><span style="color:#3366ff; line-height:25px">(inti=0;i&lt;list.size();i++)</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">{</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">name=list.get(i);</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">k=k+1;</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">}</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">}</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">timeEnd=System.currentTimeMillis();</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">System.out.println("Randomaccessusetime:"+(timeEnd-timeStart));</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">timeStart=System.currentTimeMillis();</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px"></span><span style="color:#993300; line-height:25px">for</span><span style="color:#3366ff; line-height:25px">(inta=1;a&lt;=count;a++)</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">{</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px"></span><span style="color:#993300; line-height:25px">for</span><span style="color:#3366ff; line-height:25px">(Iterator&lt;String&gt;iter=list.iterator();iter.hasNext();)</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">{</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">iter.next();</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">k=k+1;</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">}</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">}</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">timeEnd=System.currentTimeMillis();</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">System.out.println("iterator1accessusetime:"+(timeEnd-timeStart));</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">timeStart=System.currentTimeMillis();</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px"></span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px"></span><span style="color:#993300; line-height:25px">for</span><span style="color:#3366ff; line-height:25px">(inta=1;a&lt;=count;a++)</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">{</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px"></span><span style="color:#993300; line-height:25px">for</span><span style="color:#3366ff; line-height:25px">(Stringname2:list)</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">{</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">k=k+1;</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">}</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">}</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">timeEnd=System.currentTimeMillis();</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">System.out.println("iterator2accessusetime:"+(timeEnd-timeStart));</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">}</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">}</span><br style="line-height:25px"> 结果:<br style="line-height:25px"><span style="color:#3366ff; line-height:25px">Randomaccessusetime:125<br style="line-height:25px"> iterator1accessusetime:406<br style="line-height:25px"> iterator2accessusetime:391</span> </wbr></wbr></wbr></wbr></wbr></wbr>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值