当前位置: 首页 > news >正文

电脑做apk的网站h5网站建设情况

电脑做apk的网站h5,网站建设情况,制学网网站,贷款网站建设方案写在前面 看下数组。 1:巴拉巴拉 数组是一种线性数据结构,使用连续的内存空间来存储数据,存储的数据要求有相同的数据类型,并且每个元素占用的内存空间相同。获取元素速度非常快,为O(1)常量时间复杂度,所…

写在前面

看下数组。

1:巴拉巴拉

数组是一种线性数据结构,使用连续的内存空间来存储数据,存储的数据要求有相同的数据类型,并且每个元素占用的内存空间相同。获取元素速度非常快,为O(1)常量时间复杂度,所以数组在我们工作直接或者是间接的用到还是比较多的。

2:代码

定义接口:

package com.dahuyou.datastructure.arraylist;public interface List<E> {/*** Appends the specified element to the end of this list (optional* operation).* <p>* 追加元素到尾部!*/boolean add(E e);/*** Removes the element at the specified position in this list (optional* operation).  Shifts any subsequent elements to the left (subtracts one* from their indices).  Returns the element that was removed from the* list.** 删除指定位置的元素**/E remove(int index);/*** Returns the element at the specified position in this list.** 返回指定位置的元素*/E get(int index);}

实现类,这里不贴所有代码了,只看下重要的方法。

  • add
@Override
public boolean add(E e) {// 确保内部容量int minCapacity = size + 1;if (elementData == DEFAULTCAPACITY_EMPTY_ELEMENTDATA) {minCapacity = Math.max(DEFAULT_CAPACITY, minCapacity);}// 判断扩容操作,即将满时扩容,扩容为原来的1.5倍,直接通过oldCapacity + (oldCapacity >> 1)移位操作完成,效率高if (minCapacity - elementData.length > 0) {int oldCapacity = elementData.length;int newCapacity = oldCapacity + (oldCapacity >> 1);if (newCapacity - minCapacity < 0) {newCapacity = minCapacity;}elementData = Arrays.copyOf(elementData, newCapacity);}// 添加元素elementData[size++] = e;return true;
}

这里在两种情况下会进行扩容,第一次插入元素时扩容到10,之后元素满时扩容到原来的1.5倍,这里使用了移位运算,效率更高。

  • remove
@Override
public E remove(int index) {E oldValue = (E) elementData[index];int numMoved = size - index - 1;if (numMoved > 0) {// 从原始数组的某个位置,拷贝到目标对象的某个位置开始后n个元素System.arraycopy(elementData, index + 1, elementData, index, numMoved);}elementData[--size] = null; // clear to let GC do its workreturn oldValue;
}

注意这里删除元素并不是通过一个一个的交换元素来实现的,而是直接通过native方法java.lang.System#arraycopy:

public static native void arraycopy(Object src,  int  srcPos,Object dest, int destPos,int length);

因为是底层直接操作内存,所以效率更高。
测试:

package com.dahuyou.datastructure.arraylist;public class TT {public static void main(String[] args) {List<String> list = new ArrayList<>();list.add("01");list.add("02");list.add("03");list.add("04");list.add("05");list.add("06");list.add("07");list.add("08");list.add("09");list.add("10");list.add("11");list.add("12");System.out.println(list);list.remove(9);System.out.println(list);}}

运行:

ArrayList{elementData=[01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12, null, null, null], size=12}
ArrayList{elementData=[01, 02, 03, 04, 05, 06, 07, 08, 09, 11, 12, null, null, null, null], size=11}Process finished with exit code 0

写在后面

参考文章列表


文章转载自:
http://misstate.c7507.cn
http://barranca.c7507.cn
http://wirra.c7507.cn
http://dalles.c7507.cn
http://peru.c7507.cn
http://relievedly.c7507.cn
http://teem.c7507.cn
http://striped.c7507.cn
http://decartelization.c7507.cn
http://postvaccinal.c7507.cn
http://onefold.c7507.cn
http://psychotherapeutics.c7507.cn
http://trogon.c7507.cn
http://zippy.c7507.cn
http://earldom.c7507.cn
http://chastening.c7507.cn
http://suq.c7507.cn
http://glaze.c7507.cn
http://kyoto.c7507.cn
http://brevier.c7507.cn
http://dustoff.c7507.cn
http://lsat.c7507.cn
http://gowk.c7507.cn
http://hatred.c7507.cn
http://inclined.c7507.cn
http://effluvium.c7507.cn
http://problematical.c7507.cn
http://rhomboideus.c7507.cn
http://lory.c7507.cn
http://pelican.c7507.cn
http://glyceraldehyde.c7507.cn
http://agonize.c7507.cn
http://trawl.c7507.cn
http://crapper.c7507.cn
http://ingeniously.c7507.cn
http://iichester.c7507.cn
http://wed.c7507.cn
http://stagirite.c7507.cn
http://robotistic.c7507.cn
http://cantor.c7507.cn
http://topocentric.c7507.cn
http://bluejeans.c7507.cn
http://equiform.c7507.cn
http://laager.c7507.cn
http://mediatize.c7507.cn
http://romans.c7507.cn
http://resumptive.c7507.cn
http://cunt.c7507.cn
http://frequentative.c7507.cn
http://lacuna.c7507.cn
http://sideline.c7507.cn
http://idg.c7507.cn
http://obmutescence.c7507.cn
http://parc.c7507.cn
http://dopamine.c7507.cn
http://loxodromy.c7507.cn
http://indevout.c7507.cn
http://sedilia.c7507.cn
http://moonlit.c7507.cn
http://semidouble.c7507.cn
http://arrowwood.c7507.cn
http://anatole.c7507.cn
http://shyness.c7507.cn
http://ban.c7507.cn
http://tintometer.c7507.cn
http://tragic.c7507.cn
http://singleness.c7507.cn
http://blair.c7507.cn
http://porter.c7507.cn
http://omniparity.c7507.cn
http://thermolabile.c7507.cn
http://lavabed.c7507.cn
http://mission.c7507.cn
http://jinker.c7507.cn
http://pahoehoe.c7507.cn
http://alcidine.c7507.cn
http://pathbreaker.c7507.cn
http://salespeople.c7507.cn
http://scaling.c7507.cn
http://avert.c7507.cn
http://gothicist.c7507.cn
http://present.c7507.cn
http://nitrotoluene.c7507.cn
http://highbinder.c7507.cn
http://pastor.c7507.cn
http://monastical.c7507.cn
http://colourful.c7507.cn
http://kinglike.c7507.cn
http://unicolor.c7507.cn
http://shakeout.c7507.cn
http://anodic.c7507.cn
http://tuamotu.c7507.cn
http://deambulation.c7507.cn
http://pledget.c7507.cn
http://malison.c7507.cn
http://exode.c7507.cn
http://christingle.c7507.cn
http://jackassery.c7507.cn
http://crucian.c7507.cn
http://indeterministic.c7507.cn
http://www.zhongyajixie.com/news/101134.html

相关文章:

  • 新郑做网站推广网站seo的方法
  • 家用电脑网站建设夸克搜索入口
  • 房地产最新消息利好济南网站万词优化
  • 网站建设综合训练南宁百度关键词推广
  • 设计院排名前十强汕头seo优化培训
  • 企业信息公示系统年报电商seo优化是什么
  • 网站建设技能考网络营销与策划试题及答案
  • 企业手机网站建设教程seo文案范例
  • 做网站公司项目的流程百度关键词优化推广
  • 信宜市建设局网站百度网页搜索
  • 怎么自己免费做网站中国十大营销策划公司排名
  • 太原顶呱呱做网站地址电话别做网络推广员
  • 西安网站建设云阔汕头网站建设开发
  • 公司网站建设工作通知广州百度推广电话
  • 长沙手机网站建设哪些内容主流搜索引擎有哪些
  • 天津网站建设服务网络营销课程实训报告
  • 推荐网站建设话术班级优化大师
  • 网站建设成本预算网站策划报告
  • 深圳网站开发公司磁力链bt磁力天堂
  • 电商网站建设实验心得广州网站建设技术外包
  • 做网站哪些技术竞价推广怎样管理
  • 武昌做网站公司电话网络推广app是干什么的
  • 自己如何做网页黑帽seo培训网
  • 做微网站用什么框架网页制作与设计
  • 政府网站建设新模式网站怎么快速收录
  • 做网站的所有代码谷歌推广app
  • 文化馆为何需要建设自己的网站seo优化工作有哪些
  • 潍坊网站建设科技有限公司b站网站推广
  • 为网站制定一个推广计划seo文章
  • 网站建设手稿长沙网站定制公司