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

深圳整站企业网络配置方案

深圳整站,企业网络配置方案,南昌旅游集团网站建设,wordpress需要php#x1f495;世事犹如书籍#xff0c;一页页被翻过去。人要向前看#xff0c;少翻历史旧账。#x1f495; 作者#xff1a;Mylvzi 文章主要内容#xff1a;数据结构之顺序表的模拟实现 /*** Created with IntelliJ IDEA.* Description:* User: 绿字* Date:…  世事犹如书籍一页页被翻过去。人要向前看少翻历史旧账。 作者Mylvzi   文章主要内容数据结构之顺序表的模拟实现    /*** Created with IntelliJ IDEA.* Description:* User: 绿字* Date: 2023-10-12* Time: 8:53*/ import java.util.*; /*** 顺序表详解*/ public class MyArrayList {private int[] elem;// 存放数据的数组private int usedSize;// 有效数据个数public static final int DEFAULT_SIZE 10;// 初始化顺序表public MyArrayList() {this.elem new int[DEFAULT_SIZE];}public MyArrayList(int ininCapacity) {// 自定义数组的大小this.elem new int[ininCapacity];}// 打印顺序表public void display() {for (int i 0; i this.usedSize ; i) {System.out.print(this.elem[i] );}}// 添加数据 默认是在末尾添加public void add(int data) {// 满了要扩容if(isFull()) {this.elem Arrays.copyOf(this.elem,2*this.elem.length);}this.elem[usedSize] data;this.usedSize;}// 判断是否已满public boolean isFull() {if(this.usedSize this.elem.length) {return true;}return false;}// 在 pos 位置新增元素public void add(int pos, int data) {// pos位置要合法if(pos0 || posthis.usedSize) {throw new RuntimeException(pos位置不合法);}if(isFull()) {this.elem Arrays.copyOf(this.elem,2*this.elem.length);}for (int i this.usedSize-1; i pos ; i--) {this.elem[i1] this.elem[i];}this.elem[pos] data;this.usedSize;}// 判定是否包含某个元素public boolean contains(int toFind) {for (int i 0; i this.usedSize ; i) {if(this.elem[i] toFind) {return true;}}System.out.println(数组不包含该元素);return false;}// 查找某个元素对应的位置public int indexOf(int toFind) {for (int i 0; i this.usedSize ; i) {if(this.elem[i] toFind) {return i;}}System.out.println(数组不包含该元素);return -1;}// 检查pos位置是否合法private void checkPosLegal(int pos) {if(pos0 || posthis.usedSize) {throw new posOutOfBoundException(pos 位置不合法);}}// 获取 pos 位置的元素public int get(int pos) {checkPosLegal(pos);return this.elem[pos];}// 给 pos 位置的元素设为 value pos位置必须含有元素public void set(int pos, int value) {checkPosLegal(pos);this.elem[pos] value;}//删除第一次出现的关键字keypublic void remove(int toRemove) {int index indexOf(toRemove);for (int i index; i this.usedSize-1 ; i) {this.elem[i] this.elem[i1];}this.usedSize--;}// 获取顺序表长度public int size() {return this.usedSize;}// 清空顺序表public void clear() {// 如果是引用类型所有的引用都要置空 // for (int i 0; i this.usedSize; i) { // this.elem[i] null; // }this.usedSize 0;} }/*** Created with IntelliJ IDEA.* Description:* User: 绿字* Date: 2023-10-12* Time: 10:49*/ public class posOutOfBoundException extends RuntimeException{public posOutOfBoundException() {}public posOutOfBoundException(String message) {super(message);} }/*** Created with IntelliJ IDEA.* Description:* User: 绿字* Date: 2023-10-12* Time: 9:02*/ public class Test1 {public static void main(String[] args) {MyArrayList myArrayList new MyArrayList(5);myArrayList.add(1);myArrayList.add(2);myArrayList.add(3);myArrayList.add(4); /* System.out.println(myArrayList.size());myArrayList.remove(1);System.out.println(myArrayList.size());*/ // myArrayList.add(100,99); /* myArrayList.set(0,999);myArrayList.remove(999);myArrayList.remove(2);myArrayList.remove(3);myArrayList.remove(4);myArrayList.remove(5);*//* System.out.println(myArrayList.get(0));System.out.println(myArrayList.get(-1));System.out.println(myArrayList.get(999));*/ // System.out.println(myArrayList.contains(2)); // System.out.println(myArrayList.indexOf(2)); // /* myArrayList.add(0,999);myArrayList.add(0,999);myArrayList.add(0,999);myArrayList.add(0,999);myArrayList.add(0,999);*/ myArrayList.clear();myArrayList.display();} }
http://www.yutouwan.com/news/174112/

相关文章:

  • 企业网站的推广阶段和特点视频网站策划
  • 新桥企业网站建设河北沧州市网络公司
  • 在线做行测的网站2345网页游戏官网
  • 建设网站你认为需要注意合肥全网优化
  • 可以做设计赚钱的网站商业网站备案流程
  • 菏泽做网站建设找哪家网站开发工具 售价
  • 网站建设实训致谢语线上设计师网站
  • 2017年网站设计北京SEO网站优化公司
  • 阿里巴巴国际站运营培训网站开发怎么做到前后端
  • 哈尔滨网站制作哪家好通州青岛网站建设
  • 建站专业团队一站式服务网络营销的市场背景
  • 做网站的收益来源课程网站开发背景和意义
  • 威海网站建设短信精准群发seo网站推广的主要目的
  • 郴州网站排名优化徐州网站建设解决方案
  • 最新国际军事动态东莞百度快速排名优化
  • 简单的网站设计案例电商erp软件
  • 西安市网站建设公司wordpress安装主题链接路径
  • 网站管理网页制作专业前台
  • 企业网站建设可行性分析任务二手车网站开发多少钱
  • ASP.NET2.0网站开发全程解析马鞍山建设网站
  • 网站被搜索引擎收录类似 wordpress 建站
  • 网站建设与维护是什么意思粉末涂料 技术支持 东莞网站建设
  • 建筑工程网站监理答案网页数据抓取
  • 漳州网站建设技术网站建设公司不赚钱
  • 网站无备案温州在线制作网站
  • wordpress同步发帖谷歌seo搜索优化
  • 平面设计网站排行榜网络管理系统的基本组件包括哪些?
  • 大连网站制作需要多少钱怎样建立自己的网站卖东西
  • 枣庄定制网站建设制作wordpress+左侧菜单
  • 云浮网站建设公司wordpress 360字体插件